Hi I built a simple service that accepts @POST.
@Path("/incoming-fax")
public class EfaxServlet {
@POST
@Produces("text/html")
@Consumes("application/x-www-form-urlencoded")
public String doPost(@Context HttpServletRequest request) {
etc...
}
I expect a parameter named "xml" to be posted that contains the full
XML string contents.
This is a maven project, and if I run:
$ mvn jetty:run-war
And then use curl to send the content like so:
curl -v --data-urlencode xml_at_inbound-post-original.xml -H
"Content-Type:application/x-www-form-urlencoded"
http://localhost:8080/efax/incoming-fax
it works like a charm....
If I switch over to Tomcat, either via mvn using "mvn tomcat:run-war"
or else starting Tomcat 6 myself after dropping my .war file in there,
I never receive any paramters from the HttpServletRequest.
I added this snippet to the @POST method:
Map<String, String> map = request.getParameterMap();
if(map.isEmpty()) {
LOGGER.error("request has no parameters");
}
for(String key : map.keySet()) {
LOGGER.error("key: "+key+" value: "+map.get(key));
}
If I run this with Jetty, it sees "xml" parameter, but if I run the
same on Tomcat, it sees no parameters at all.
I'm really not seeing the problem here. Can anyone provide a clue
what might be going on?? My thanks in advance.
Regards,
Davis
My web.xml is below:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="
http://java.sun.com/xml/ns/javaee"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>ServletAdaptor</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<load-on-startup>1</load-on-startup>
<!-- other init-param here -->
</servlet>
<servlet-mapping>
<servlet-name>ServletAdaptor</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>