users@jersey.java.net

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

From: James Adams <monocongo_at_gmail.com>
Date: Thu, 12 Nov 2009 09:41:43 -0800 (PST)

Small change to the below message, the actual cURL command used is this
("new_state" is the first parameter, not "action"):

curl -v -X PUT -d
"new_state=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"


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-tp3994413p3994457.html
Sent from the Jersey mailing list archive at Nabble.com.