Thanks so much for the clarification, Marc.
So I can change my code to read FormParams from the data payload or I can
change the cURL command to include the parameters on the URI so they'll come
in as QueryParams. What is the best practice, if any, to follow in this
case?
--James
Marc Hadley wrote:
>
> @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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
>
--
View this message in context: http://n2.nabble.com/Query-parameters-not-making-it-into-my-method-tp3994413p3994864.html
Sent from the Jersey mailing list archive at Nabble.com.