You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sebastian Gomez <sa...@gmail.com> on 2009/08/03 19:22:42 UTC

JAXRS Handler modifying destination URI

Hi everyone.
I'd like to implement a Handler that will modify the destination URI of the
request appending some modifiers to it, eg. the current date. I'd like this
being done in the handler, not in the method. I've been looking through the
documentation and source code but I haven't found anything similar, so I'd
like to know if something like what I need is possible. If not, is there
some kind of workaround to obtain a similar result?

In other words, I'd like my client calling /id/1 and have a method annotated
with @Path("/id/1/date/{date}") to be able to get the date from the {date}
variable.

Hope someone can help. Thanks in advance.

Sebastian Gomez

Re: JAXRS Handler modifying destination URI

Posted by Sergey Beryozkin <se...@iona.com>.
Hi

thanks Dan, there's no JAX-RS specific function which would do it. One might
also try to register a JAX-RS
RequestHandler filter and do the same...

cheers, Sergey


dkulp wrote:
> 
> 
> I haven't looked into the JAX-RS stuff enough to know if there is a "pure
> JAX-
> RS" way to do this.   With CXF, you should be able to register a CXF 
> interceptor on the incoming interceptor chain that grabs the information
> from 
> the Message and modifies it.   If it's registered really early in the
> chain, 
> like USER_STREAM phase, it would run before any of our JAX-RS stuff.    
> Probably something like:
> 
> String s = m.get(Message.REQUEST_URI);
> s += "/data/" + date;
> m.put(Message.REQUEST_URI, s);
> 
> Dan
> 
> 
> On Mon August 3 2009 1:22:42 pm Sebastian Gomez wrote:
>> Hi everyone.
>> I'd like to implement a Handler that will modify the destination URI of
>> the
>> request appending some modifiers to it, eg. the current date. I'd like
>> this
>> being done in the handler, not in the method. I've been looking through
>> the
>> documentation and source code but I haven't found anything similar, so
>> I'd
>> like to know if something like what I need is possible. If not, is there
>> some kind of workaround to obtain a similar result?
>>
>> In other words, I'd like my client calling /id/1 and have a method
>> annotated with @Path("/id/1/date/{date}") to be able to get the date from
>> the {date} variable.
>>
>> Hope someone can help. Thanks in advance.
>>
>> Sebastian Gomez
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/JAXRS-Handler-modifying-destination-URI-tp24794770p24823032.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JAXRS Handler modifying destination URI

Posted by Daniel Kulp <dk...@apache.org>.
I haven't looked into the JAX-RS stuff enough to know if there is a "pure JAX-
RS" way to do this.   With CXF, you should be able to register a CXF 
interceptor on the incoming interceptor chain that grabs the information from 
the Message and modifies it.   If it's registered really early in the chain, 
like USER_STREAM phase, it would run before any of our JAX-RS stuff.    
Probably something like:

String s = m.get(Message.REQUEST_URI);
s += "/data/" + date;
m.put(Message.REQUEST_URI, s);

Dan


On Mon August 3 2009 1:22:42 pm Sebastian Gomez wrote:
> Hi everyone.
> I'd like to implement a Handler that will modify the destination URI of the
> request appending some modifiers to it, eg. the current date. I'd like this
> being done in the handler, not in the method. I've been looking through the
> documentation and source code but I haven't found anything similar, so I'd
> like to know if something like what I need is possible. If not, is there
> some kind of workaround to obtain a similar result?
>
> In other words, I'd like my client calling /id/1 and have a method
> annotated with @Path("/id/1/date/{date}") to be able to get the date from
> the {date} variable.
>
> Hope someone can help. Thanks in advance.
>
> Sebastian Gomez

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog