users@jersey.java.net

Re: [Jersey] Tomcat Deployment Vs. Jetty Deployment -- no parameters from HttpServletRequest

From: Davis Ford <davisford_at_gmail.com>
Date: Wed, 19 Nov 2008 10:15:33 -0500

Paul -- thanks a lot for the quick response. Confirmed that this does
fix the issue for me. When you have a chance, can you elaborate
briefly on your statement about Tomcat logging configuration?
How/where could I configure Tomcat logging to consume the InputStream
and cause this issue to crop up again?

Thanks in advance,
Davis

On Wed, Nov 19, 2008 at 5:36 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
> Hi Davis,
>
> It is a bug in Tomcat and also Glassfish (i tried with v2 and v3 and can
> reproduce the same behaviour). It is because Jersey obtains the InputStream
> instance from the HttpServletRequest which is disabling the form parsing of
> the parameters in the request, even though no bytes have been read from the
> stream (at the end of the email is a servlet that reproduces the same bug).
>
> You can do this instead:
>
> @POST
> @Produces("text/html")
> @Consumes("application/x-www-form-urlencoded")
> public String doPost(@FormParam("x") String x, @Context HttpRequestContext
> request) {
> Form f = request.getFormParameters();
> }
>
> But take care that there are no valves in Tomcat logging parameters
> otherwise Tomcat will consume the request and there will be nothing left for
> Jersey to read.
>
> Paul.