If it is JAX-RS then you can also register a custom RequestHandler filter and
wrap a message in org.apache.cxf.jaxrs.impl.HttpHeadersImpl which simplifies
the access to headers - you can probbaly do it even in the CXF interceptor.

Cheers, Sergey


liw wrote:
> 
> Great! Thanks a lot.
> 
> Li
> 
> dkulp wrote:
>> 
>> 
>> If you have the Message, you should just be able to do:
>> 
>> message.get(Message.PROTOCOL_HEADERS) which would be a Map<String, 
>> List<String>> type thing.
>> 
>> You could also do:
>> message.get("HTTP.REQUEST") 
>> to get the HttpServletRequest object.
>> 
>> Dan
>> 
>> 
>> On Thu August 13 2009 2:12:00 pm liw wrote:
>>> Hi,
>>>
>>> We need to extract HTTP headers and apply some business logic based on
>>> the
>>> header info when REST request comes in. We are planning to writer a
>>> custom
>>> InInterceptor by extending AbstractPhaseInterceptor
>>>
>>> However, the AbstractPhaseInterceptor.handleMessage method only exposes
>>> a
>>> Message object.
>>>
>>>
>>> It looks like that I can get the Exchange from Message. From Exchange, I
>>> can get cxf HTTPSession. However, it doesn't look like there is any API
>>> for
>>> get the HTTPServletRequest from HTTPSession.
>>>
>>> I wonder if there is any way to get the HTTPSevletRequest when writing
>>> an
>>> interceptor for REST.
>>>
>>>
>>> Thanks in advance,
>>>
>>> Li
>> 
>> -- 
>> Daniel Kulp
>> [email protected]
>> http://www.dankulp.com/blog
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-intercept-message-and-extract-HTTP-headers-in-REST-tp24956057p24970487.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to