Infatti ora capisco che mi sono spiegato male...
Ho un'applicazione che comunica con Tomcat scritto in C. Io devo fare una servlet che riceva una richiesta HTTP non da una form o da una pagina html/jsp o quant'altro...
Io ho un'applicazione esterna, che parte con Java Web Start, che manda richieste di questo tipo:
POST /NewRequest/ HTTP/1.0 Content-type: application/x-www-form-urlencoded Content-length: 161 <?xml version='1.0' encoding='ISO-8859-1' standalone='no'?> <Request MO="FDSAuthority" Operation="Login" SessionId="0000"> <User>login</> <PassWord>login</> </>
Il fatto è che io devo mettere tutto questo sotto Glassfish.
Ho modificato il file web.xml in questo modo:
codice:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>GreetingServlet</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>GreetingServlet</display-name>
<servlet-name>GreetingServlet</servlet-name>
<servlet-class>servlet.GreetingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>GreetingServlet</servlet-name>
<url-pattern>/NewRequest/</url-pattern>
</servlet-mapping>
</web-app>
e il file sun-web.xml in questo modo
codice:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
<context-root>/NewRequest/</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class java code.</description>
</property>
</jsp-config>
</sun-web-app>
La mia servlet usa il metodo processRequest(HttpServletRequest req, HttpServletResponse resp) in cui, per ora, deve solo recuperare la richiesta, e stamparmi la richiesta HTTP che ricevo tramite un PrintWriter out.
Spero di essere stato più chiaro...
Daniele.