cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <ning.ji...@iona.com>
Subject Re: setting HTTP response headers
Date Fri, 03 Nov 2006 06:29:30 GMT
Hi Conrad,

You can use MessageContext to get request header and response header 
with the last CXF code in the repository.
You can also get the response header from client side by using the 
response context.
Please see the Systest of REST 
RestClientServerTest.testHttpGETDispatcher() for more detail.

Enjoy!

Willem.

Conrad O'Dea wrote:

>On Thu, 2006-11-02 at 10:00 +0000, Sergey Beryozkin wrote:
>  
>
>>Do we have to write this code oursellves or is it something which will end up in some
common utility class ?
>>    
>>
>
>It's a workaround.  The response header should be settable through the
>MessageContext. 
>
>
>  
>
>>Cheers, Sergey
>>
>>
>>    
>>
>>>On Thu, 2006-11-02 at 07:48 +0000, Conrad O'Dea wrote:
>>>
>>>      
>>>
>>>>thanks for that.  The code I'm writing is basically JAX-WS (although
>>>>becoming more cxf specific).  Is it possible to get from the
>>>>EndpointImpl to the outMessage?
>>>>
>>>>        
>>>>
>>>I've managed to get the response header successfully set.  There's a
>>>path to the outbound Message through the MessageContext:
>>>
>>> WrappedMessageContext wmc = (WrappedMessageContext)ctx;
>>> Message msg = wmc.getWrappedMessage();
>>> Exchange xchg = msg.getExchange();
>>> Message outMsg = xchg.getOutMessage();
>>> respHeaders = (Map<String, List<String>>)outMsg.get(Message.PROTOCOL_HEADERS);
>>> respHeaders.put(headerName, headerValue);
>>>
>>>and then the headers I set appear in the HTTP response.
>>>
>>>
>>>
>>>      
>>>
>
>
>  
>


Mime
View raw message