THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
First, declare a private field for the WebServiceContext in your service implementation, and annotate it as a resource:
...
Then, within your implementing methods, you can access the MessageContext, HttpServletRequest, and HttpServletResponse as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
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); HttpServletRequestHttpServletResponse response = (HttpServletResponse) ctx.get(AbstractHTTPDestination.HTTP_RESPONSE); |
...