users@jersey.java.net

[Jersey] Re: How to set two values of the same type in Response

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Fri, 08 Jul 2011 08:03:03 +0200

Hi Jitesh,

please see in-line...

On 07/06/2011 02:39 AM, Jitesh wrote:
> Thanks Jason.Three questions -
>
> a.)How do I read the header on client side?

ClientResponse cr = webResource.get(ClientResponse.class);
cr.getHeaders()... // see [1]

> b.)Why am I getting blank value even when I am setting only one value - as I
> mentioned in my post#2 of this thread?
I don't know. You might want to check out Jersey hello-world examples
[2], [3],
which do exactly that (pass String from server to client) without any
issues.

> c.)Can't I set multiple values in a list, add that to Response and then get
> it on client side?If yes,how do I do it?
You would need to implement a custom message body reader/writer [4], [5]
for that.
See [6] for an example.

HTH,

~Jakub

[1]http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/client/ClientResponse.html#getHeaders%28%29
[2]http://download.java.net/maven/2/com/sun/jersey/samples/helloworld/1.8/helloworld-1.8-project.zip
[3]http://download.java.net/maven/2/com/sun/jersey/samples/helloworld-webapp/1.8/helloworld-webapp-1.8-project.zip
[4]http://jsr311.java.net/nonav/javadoc/javax/ws/rs/ext/MessageBodyReader.html
[5]http://jsr311.java.net/nonav/javadoc/javax/ws/rs/ext/MessageBodyWriter.html
[6]http://download.java.net/maven/2/com/sun/jersey/samples/entity-provider/1.8/entity-provider-1.8-project.zip
> Thanks much.
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/How-to-set-two-values-of-the-same-type-in-Response-tp6550971p6552569.html
> Sent from the Jersey mailing list archive at Nabble.com.
>