users@jersey.java.net

Re: [Jersey] Query parameters not making it into my method

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 12 Nov 2009 13:19:05 -0500

@QueryParam extracts parameters from the request URI, you need
@FormParam instead to extract values from the request body.

Marc.

On Nov 12, 2009, at 12:35 PM, James Adams wrote:

>
> I have a Jersey resource class with a method used for PUT requests
> which has
> some query parameters. When this method is invoked via a curl
> command the
> parameters supplied do not take and my method sees only null for these
> parameter variables. Below is the resource class method and the curl
> command used to invoke it.
>
> Resource method:
>
> @PUT
> @Produces( { "application/vnd.com.abc.ServiceInstance+json",
> "application/vnd.com.abc.ServiceInstance+xml",
> "application/json",
> "application/xml",
> "text/xml" })
> public Response updateState(@QueryParam("new_state") final String
> state,
> @QueryParam("mac_address") final String
> macAddress,
> @QueryParam("ip_address") final String
> ipAddress)
> {
> // here the state, macAddress, and ipAddress values are
> always null
> }
>
>
> cURL command:
> curl -v -X PUT -d
> "action=ready&mac_address=2:8:20:28:29:c6&ip_address=172.0.14.111"
> "http://123.45.67.89:8080/myapp/resources/service_instances"
>
>
> Can anyone see what I'm doing wrong which is keeping the parameter
> values
> from making it through? Thanks in advance for your help.
>
> --James
> --
> View this message in context: http://n2.nabble.com/Query-parameters-not-making-it-into-my-method-tp3994413p3994413.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
>