You can look here for the info on this:
http://cwiki.apache.org/CXF20DOC/servlet-transport.html


Accessing the MessageContext and/or HTTP Request and Response
Sometimes you'll want to access more specific message details in
your service implementation. One example might be accessing the actual
request or response object itself. This can be done using the
WebServiceContext object.
First, declare a private field for the WebServiceContext in your service 
implementation, and annotate it as a resource:
@Resource
private WebServiceContext context;
Then, within your implementing methods, you can access the
MessageContext, HttpServletRequest, and HttpServletResponse as follows:
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.ws.handler.MessageContext;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
...

MessageContext ctx = context.getMessageContext();
HttpServletRequest request = (HttpServletRequest) 
ctx.get(AbstractHTTPDestination.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse) 
ctx.get(AbstractHTTPDestination.HTTP_RESPONSE);
Also on the lists somewhere it shows you how to do this from an interceptor.  
Looks like this should
suffice for you though.



----- Original Message ----
From: Marc Logemann <[EMAIL PROTECTED]>
To: users@cxf.apache.org
Sent: Tuesday, September 9, 2008 11:03:16 AM
Subject: accessing ServletContext from within @WebMethod

Hi,

in a webservice i need to get hold of an ServletContext because i need  
to load some resources for BIRT eclipse reporting.
Is this possible somehow?

--
Marc Logemann
blog http://logemannreloaded.blogspot.com
privat http://www.logemann.org

Reply via email to