You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "KARR, DAVID" <dk...@att.com> on 2016/09/12 17:07:32 UTC

Get request metadata into controller method parameters?

I'd like to add some request metadata diagnostics to my JAX-RS REST service.  For instance, I'd like to get the IP address of the request.  I would imagine I could do this with a servlet filter, but I want to directly associate it with the request and response.  Is it possible to inject data like this directly into the controller method?

-----------------
David M. Karr | AT&T | Digital Experience Technology Services
(206) 909-0664 cell
(425) 892-5432 cell
(206) 393-9042 skype



Re: Get request metadata into controller method parameters?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi David

Just in case, it is CXF specific - but if you need to inject more than 
one JAX-RS context then it starts making sense considering using it.
UriInfo, SecurityContext, Request, HttpHeaders, HttpServletRequest, etc, 
can be injected

Sergey
On 12/09/16 19:16, KARR, DAVID wrote:
>> -----Original Message-----
>> From: KARR, DAVID
>> Sent: Monday, September 12, 2016 10:08 AM
>> To: cxf-users@apache.org
>> Subject: Get request metadata into controller method parameters?
>>
>> I'd like to add some request metadata diagnostics to my JAX-RS REST
>> service.  For instance, I'd like to get the IP address of the request.
>> I would imagine I could do this with a servlet filter, but I want to
>> directly associate it with the request and response.  Is it possible to
>> inject data like this directly into the controller method?
>
> Never mind.  @Context and MessageContext does the trick.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

RE: Get request metadata into controller method parameters?

Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID
> Sent: Monday, September 12, 2016 10:08 AM
> To: cxf-users@apache.org
> Subject: Get request metadata into controller method parameters?
> 
> I'd like to add some request metadata diagnostics to my JAX-RS REST
> service.  For instance, I'd like to get the IP address of the request.
> I would imagine I could do this with a servlet filter, but I want to
> directly associate it with the request and response.  Is it possible to
> inject data like this directly into the controller method?

Never mind.  @Context and MessageContext does the trick.