Hello Sergey,

I can actually see the headers in my client.So it is working.
Thanks a lot for the replies.

Vishal


Sergey Beryozkin-2 wrote:
> 
> Hi Vishal
> 
> Excellent - I think it's actually the best way if you'd like to avoid
> doing it all in the application code where you can do the same by
> returning Response - which does require you to have a signature with a
> JAX-RS specific type.
> 
> Likewise, you can do it with a CXF out-interceptor too - but what you
> did seems perfect.
> 
> So if it does work then it's a bug indeed that the headers are lost when
> updated in MessageBodyWriter.writeTo() - as I said I'll get to fixing it
> asap
> 
> Cheers, Sergey
>  
> 
> -----Original Message-----
> From: Vishal.a [mailto:[email protected]] 
> Sent: 06 February 2009 23:31
> To: [email protected]
> Subject: Re: Setting headers in JAXRS
> 
> 
> I think i got it to work,but i am not sure if this is the best way to do
> it
> 
> public class InsertHeaderHandler implements ResponseHandler
> {
>     private static final String METHOD_TYPE = "GET";
> 
>     public Response handleResponse(Message message,
> OperationResourceInfo
> operationResourceInfo, Response response)
>     {
>         if(operationResourceInfo.getHttpMethod().equals(METHOD_TYPE))
>         {
>             response.getMetadata().put("Cache-Control",Arrays.asList(new
> Object[] {"no-cache"}));
>             response.getMetadata().put("Expires",Arrays.asList(new
> Object[]
> {"0"}));
>         }        
>         return response;
>     }
> }
> 
> Any input would be great.
> 
> Thanks,
> Vishal
> 
> 
> 
> Vishal.a wrote:
>> 
>> Hello Sergey,
>> 
>> My problem is i need to add the following to the headers of all the
> GET
>> request
>> 
>> "Cache-Control","no-cache"
>> "Expires", 0
>> 
>> Do u think there is a better way of doing this?
>> 
>> Thanks,
>> Vishal
>> 
>> 
>> Sergey Beryozkin-4 wrote:
>>> 
>>> Hi Vishal - looks like they're ignored by the HttpDestination layer -
>>> I'll investigate...
>>> I'm very busy at the moment with the client api work - so I'll try to
> get
>>> to it early next week - if you can debug and spot where 
>>> they're lost then it would help...
>>> 
>>> Cheers, Sergey
>>> 
>>> 
>>> ----- Original Message ----- 
>>> From: "Vishal.a" <[email protected]>
>>> To: <[email protected]>
>>> Sent: Thursday, February 05, 2009 10:33 PM
>>> Subject: Setting headers in JAXRS
>>> 
>>> 
>>>>
>>>> Hello All,
>>>>
>>>> I am trying to add values to the headers in my writeto method in
>>>> MessageBodyWriter like this
>>>>
>>>> headers.putSingle("Cache-Control","no-cache");
>>>> headers.putSingle("Expires", 0);
>>>>
>>>> If i look at the log of the outbound message i can see the headers
> in
>>>> there,but however when the client receives it,the headers are not in
>>>> there.
>>>>
>>>> Can someone please help me.
>>>>
>>>> Thanks,
>>>> Vishal
>>>> -- 
>>>> View this message in context:
>>>>
> http://www.nabble.com/Setting-headers-in-JAXRS-tp21862657p21862657.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Setting-headers-in-JAXRS-tp21862657p21882901.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Setting-headers-in-JAXRS-tp21862657p21892057.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to