5.3. HTTP cookies

5.3.1. Enabling cookie support

To enable cookie support, you need to enable the session property. This causes requests sent via the port to use the same cookie jar, so if the server responds with a cookie, the next request will go out with those cookies. This allows the server to use the normal session tracking mechanism like HttpSession.

Sending HTTP headers

HelloPort port = ...;

5.3.2. Accessing HTTP cookies in the response


5.3.3. Accessing HTTP cookies on the server

When the web service is using servlets as the transport mechanism, you can use servlet's native support for cookies. See the following code to how to access javax.servlet.http.HttpServletRequest from your service.

Accessing cookies

class MyService {
    @Resource WebServiceContext context;
    public void foo() {
        HttpServletRequest  rq = (HttpServletRequest)context.getMessageContext().get(MessageContext.SERVLET_REQUEST);
        HttpServletResponse rs = (HttpServletResponse)context.getMessageContext().get(MessageContext.SERVLET_RESPONSE);

Terms of Use; Privacy Policy; Copyright ©2013-2017 (revision 20160708.bf2ac18)
Please Confirm