users@jersey.java.net

[Jersey] Re: How to set error response code from Rest web service and get it by Jersey client

From: Jitesh <jisinha_at_cisco.com>
Date: Tue, 28 Jun 2011 17:25:51 -0700 (PDT)

Thanks Pavel.

 

How do we send header parameters through GET request?

I am using following code and on server side I get appKey as null -

 

This is client side code -

Client client = Client.create();

WebResource service = client.resource(URL);

MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();

queryParams.add("transactionId",testCommand.getTransactionId()) ;

 

ClientResponse response =
service.queryParams(queryParams).header("appKey",appkey).get(ClientRespo
nse.class);

 

Server Side -

String appKey = request.getParameter("appKey") ;

 

Is something wrong in above code?

 

Thanks

-Jitesh

 

From: Pavel Bucek-2 [via Jersey]
[mailto:ml-node+6526332-740089095-342109_at_n2.nabble.com]
Sent: Tuesday, June 28, 2011 12:53 PM
To: Jitesh Sinha -X (jisinha - Siliconweb Inc. at Cisco)
Subject: Re: How to set error response code from Rest web service and
get it by Jersey client

 

http://jersey.java.net/nonav/apidocs/latest/jersey/javax/ws/rs/core/Resp
onse.html
http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/cl
ient/ClientResponse.html
http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e363


On 6/28/11 9:31 PM, Jitesh Sinha -X (jisinha - Siliconweb Inc. at Cisco)

wrote:
> Is there a way to set error code and message by Rest API and then to
> retrieve it by using Jersey client?
> Currently I know only about Response.ok(variable).build() which is
> supposed to be called when request has been processed ok.
>
> Thanks
> -Jitesh
>




________________________________

If you reply to this email, your message will be added to the discussion
below:

http://jersey.576304.n2.nabble.com/How-to-post-a-file-and-other-form-fie
lds-by-Jersey-client-tp6502947p6526332.html

To unsubscribe from How to post a file and other form fields by Jersey
client, click here
<http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=unsub
scribe_by_code&node=6502947&code=amlzaW5oYUBjaXNjby5jb218NjUwMjk0N3wzMzg
xMjAxMjY=> .



--
View this message in context: http://jersey.576304.n2.nabble.com/How-to-post-a-file-and-other-form-fields-by-Jersey-client-tp6502947p6527155.html
Sent from the Jersey mailing list archive at Nabble.com.