Hi Sadhana
Unfortunatley, it will only be possible to inject contexts in filters starting
from 2.2.4.
However, as a workaround, you can get most of what you can get from a
MessageContext using a provided Message instance
here's some examples :
HttpServletRequest request =
(HttpServletRequest)message.get(AbstractHttpDestination.HTTP_REQUEST)
HttpHeaders headers = new HttpHeadersImpl(message);
UriInfo ui = new UriInfoImpl(m, null);
// etc...
let me know please if you need more info,
cheers, Sergey
----- Original Message -----
From: "Sadhana Jain" <[email protected]>
To: <[email protected]>
Cc: "Sergey Beryozkin" <[email protected]>
Sent: Tuesday, September 29, 2009 8:54 AM
Subject: HELP! Was:RE: Accessing JAX-RS MessageContext in a filter
Hi cxf group,
Could you please respond to my question below? The main
question is if Context get/set is allowed in JAX-RS filters?
I need an answer urgently as I need to deliver some code by tomorrow
And I need to figure out whether to implement a work around or there is
Something simple I am missing and have overlooked in using JAX-RS CXF?
Thanks very much for your help in the past. Hope to hear from
Someone soon.
Sadhana
-----Original Message-----
From: Sadhana Jain [mailto:[email protected]]
Sent: Monday, September 28, 2009 10:53 AM
To: [email protected]
Subject: Accessing JAX-RS MessageContext in a filter
Hi All,
I am trying to get access to MessageContext in a filter (that implements
RequestHandler interface) by doing this:
private MessageContext mc;
@Context
public void setMessageContext(MessageContext msgC) {
mc=msgC;
}
Because I saw in the list that a bug was filed about if @Context was used on a
fields like this:
@Context
private MessageContext mc;
But even using Context on the setter does not work. Do I need to do any wiring
in the Spring file when I use the Setter like above?
Is @Context suppose to work with filters ( I thought they should as filters are
like providers)?
What I am trying to do using Context is set a Map that I created in the filter after processing http headers And I want to access
that Map in some other class later in the code and would like to use @Context to get the map.
Is this a good use of @Context? Or can I do this in any other way?
Thanks a lot for any help.
Sadhana
Sadhana Jain
Sr. Software Engineer
Rovi Corporation
795 Folsom St, Suite 200
San Francisco, CA 94107
Direct: 415.247.5023 | Mobile: 925.212.6495 [email protected]
rovicorp.com
Rovi. The new name for Macrovision.