users@jersey.java.net

Re: [Jersey] Jersey log message re: form parameters being consumed "earlier"

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 24 Nov 2009 09:34:56 +0100

Hi Mark,

It is informing you that the request entity of media type "application/
x-www-form-urlencoded" has been consumed by the Servlet layer,
probably by a servlet filter when one of the methods
ServletRequest.getParameter* is called.

Servlet does not distinguish between query parameters and form
parameters when parameters are obtained. So if a form-based request
entity is present and parameters are obtained it will consume that
entity thus leaving Jersey with no entity to consume. So Jersey can
only keep on working in this respect using @FormParam in conjunction
with the Servlet parameters.

Jersey cannot reliably construct bytes of the request entity because
query and form parameters are merged together into the servlet
parameters.

Are you utilizing a servlet filter that accesses servlet request
parameters?


Do you think this type of warning is more appropriate in "development
mode"?

BTW we want to include more information in a "development mode" such
as informing how the request was processed when Jersey returns an
error e.g. 404 or 405 to aid debugging. We have some feedback that
every once in a while things are tricky to work out what is going on
when the application is not working as expected. It was suggested for
such cases that we return a response entity with such information, or
something in a response header.

Hth,
Paul.

On Nov 24, 2009, at 1:20 AM, Mark Petrovic wrote:

> Hi.
>
> I find this log message in my server that is mysterious:
>
>
> [#|2009-11-21T00:01:39.466-0800|WARNING|sun-appserver2.1|
> com.sun.jersey.spi.container.servlet.WebComponent|
> _ThreadID
> =
> 19
> ;_ThreadName
> =httpSSLWorkerThread-38080-2;_RequestID=39e57fc2-0b91-42ca-
> b3a2-4415e9c0951f;|A servlet POST request, to the URI https://blech.example.org/services/actions/createCp?userName=flerg@blarney.com&password=**********&firstName=Sasha&lastName=Who&postal
> Code=95129&state=CA&country=US, contains form parameters in the
> request body but the request body has been consumed by the servlet
> or a servlet filter accessing the request parameters. Only resource
> methods using @FormParam will work as expected. Resource methods
> consuming the request body by other means will not work as expected.|
> #]
>
> My app *seems* to be working in all regards, but the log message
> nonetheless bothers me.
>
> What is the message trying to tell me?
>
> Thanks.
>
> --
> Mark Petrovic
> mark_at_petrovic.org
> http://www.petrovic.org
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>