users@jsr311.java.net

Re: x-www-form-urlencoded Content Type and rest WS

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 20 Aug 2008 10:59:03 +0200

Hi Denis,

Do you have any valves registered for logging? Annoyingly servlet does
not differentiate between query parameters in the URI and form
parameters in the body of the request. If there is a logging valve that
prints out the parameters (using Servlet.getParameter*) then the body of
the request is consumed by the valve before it reaches the JAX-RS
servlet. This is why you could be observing null parameters.

The other issue may be that the information sent by the client is
incorrect. Can you tell me how you are POSTing the form parameters?

Thanks,
Paul.

Denis wrote:
> Hi Paul,
>
> Thanks for your reply.
> I tried the 2 methods you suggested but it still doesn't work.
> In both cases, my params are null...
> Actually i'm using jersey-0.9-ea-SNAPSHOT.jar and jsr311-api-0.8.jar.
>
> I was wondering if there's a problem if I deploy my war on Tomcat
> because when
> I had the following code on the web service it displays
> "org.apache.catalina.connector.CoyoteInputStream":
>
>
> @Context
> HttpServletRequest servletRequest;
>
> @POST
> @ConsumeMime(MediaType.APPLICATION_FORM_URLENCODED)
> @Path("/test/")
> public Response aMethod(@FormParam("param") String param) {
>
> System.out.println(servletRequest.getInputStream().getClass().toString());
> return null;
> }
>
> It really drives me crazy...
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109