users@jersey.java.net

Re: [Jersey] _at_FormParam and URL-Decoding

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 30 Sep 2009 17:57:58 +0200

Hi,

The form parsing implementation is using URLDecoder.decode [1] to
decode name and values, which conforms to data encoded according to
the rules of application/x-www-form-urlencoded.

Can you enabling logging either on the client or server side [2]. I am
wondering how the data is encoded on the wire.

Paul.

[1] http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLDecoder.html

[2] I would point you to the online javadoc but java.net is down at
the moment, see:
      com.sun.jersey.api.container.filter.LoggingFilter
      for how to enable logging on the server side.


On Sep 30, 2009, at 5:44 PM, Charx wrote:

>
> Hello,
>
> i don't know why jersey (1.0.3) does not decode the FormParams in my
> code
> automatically:
>
> <code>
> @POST
> @Path("{spaceId}/release")
> @Consumes("application/x-www-form-urlencoded")
> public Response addUserToSpace(@PathParam("spaceId") final String
> spaceId,
> // @FormParam("friendEmails") final String emailList,
> // @FormParam("emailSubject") final String emailSubject,
> // @FormParam("emailBody") final String emailBody) {
> final MultivaluedMap<String, String> formParameters)
> { .... }
> </code>
>
> As you can see, i tried it with and without the @Consumes
> annotation, with
> and without @FormParam annotation.
>
> Now when the client is sending some encoded data, e.g. an email for
> the
> emailList, then it will still appear encoded in my method body. But
> the spec
> says on page 9, 3.3.2 Parameters: "The Encoded annotation may be
> used to
> disable automatic URI decoding of parameter values", so i guess that
> normally jersey should be in charge of decoding this parameter
> automatically....
>
> What am i missing here?
>
> Thanks in advance..
>
>
> --
> View this message in context: http://n2.nabble.com/FormParam-and-URL-Decoding-tp3743474p3743474.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>