Hi Kynan,

I am not sure if this answers your question, I'll try:

These are what I use for an inbound handler extending AbstractPhaseInterceptor<Message> at phase Phase.RECEIVE

1. message.get(Message.BASE_PATH) would give you the path

2. message.get(Message.QUERY_STRING) should give you everything on the right hand side of '?'. Since this would be a key-value pair, getting the name and value should be easy.

3. message.get(Message.REQUEST_URI) should give you the actual URI used. This would allow you to manually retrieve your path parameters. I am not sure how to retrieve the name assigned to that though.

4. message.get(Message.PROTOCOL_HEADERS) would give you all the Http headers, quite useful for authentication.

Also, if everything you need is done by a specific interceptor, then maybe calling getAfter().add() at the constructor should cover it. :)

Hth

Gabo

Kynan Fraser wrote:
Hi All,

I'm writing a request handler which deals with the method going to be
invoked and the parameters provided (both query and path, both name and
value of each parameter). However i'm having some problem getting at the
path paramter names and values - well I can ge the names but i need the
values too.

It seems like the easiest way to get path paramters is to use
UriInfo(message) then getPathParameters(). But this requires the
URI_TEMPLATE.TEMPLATE_PARAMETERS to be set on the message to be used in the
UriInfo constructor. This doesn't seem to be getting done until after the
request handlers are called in the JAXRSInInterceptor.

In CXF 2.2.1 - Request handlers are called on line 158 but the values for
the URI_TEMPLATE.TEMPLATE_PARAMETERS are not set on the message until line
191.

I figure I can always rerun findTargetMethod() or match the uri template and
populate it myself but thought there might be a way of getting this which is
better.

Any tips?

Thanks.
Kynan
------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.76/2343 - Release Date: 09/03/09 05:50:00

Reply via email to