Hi Jakub,
Thanks for your response. I tried HeaderParam code that you mentioned in
your email and it still does not work. I still get appKey as null.
Do I need to do something else?
Thanks
-Jitesh
From: Jakub Podlesak [mailto:jakub.podlesak_at_oracle.com]
Sent: Wednesday, June 29, 2011 10:47 PM
To: users_at_jersey.java.net
Subject: [Jersey] Re: How to set error response code from Rest web
service and get it by Jersey client
Hi Jitesh,
the client side looks fine.
On the server side, you might want to consume the header
parameter with the @HeaderParam annotation. E.g.
@GET
public Response getMethod(@HeaderParam("appKey") String appKey) {
...
}
~Jakub
On 06/29/2011 02:32 AM, Jitesh wrote:
Sorry one correction -
On serverside it is
String appKey = request.getHeader("appKey") ;
From: Jitesh Sinha -X (jisinha - Siliconweb Inc. at Cisco)
Sent: Tuesday, June 28, 2011 5:26 PM
To: 'Pavel Bucek-2 [via Jersey]'
Subject: RE: How to set error response code from Rest web service and
get it by Jersey client
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:[hidden email]]
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.
________________________________
View this message in context: RE: How to set error response code from
Rest web service and get it by Jersey client
<
http://jersey.576304.n2.nabble.com/How-to-post-a-file-and-other-form-fi
elds-by-Jersey-client-tp6502947p6527169.html>
Sent from the Jersey mailing list archive
<
http://jersey.576304.n2.nabble.com/> at Nabble.com.