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.