Package com.sun.xml.ws.transport.http.client

Examples of com.sun.xml.ws.transport.http.client.HttpCookie$CookieAttributeAssignor


  public static void setRequestCookieTest(HelloWS port)
  {
    String sessionId = "blah:blah:1234";
    System.out.println("Session id: " + sessionId);
    final HttpCookie jSessionId = new HttpCookie("JSESSIONID=" + sessionId);
    System.out.println("Cookie name: " + jSessionId.getName());
    System.out.println("JSessionId: " + jSessionId.toString());

    Map<String, List<String>> headers = (Map<String, List<String>>) ((BindingProvider) port)
        .getRequestContext().get( MessageContext.HTTP_RESPONSE_HEADERS);

    if (null == headers) {
      System.out.println("Headers was null");
      headers = Collections.singletonMap("Cookie", Collections
          .singletonList(jSessionId.toString()));
      ((BindingProvider) port).getRequestContext().put(
          MessageContext.HTTP_REQUEST_HEADERS, headers);
    } else {
      System.out.println("Headers was not null");
      List<String> cookies = headers.get("Cookie");
      if (null == cookies) {
        System.out.println("Cookies was null");
        cookies = new ArrayList<String>();
        headers.put("Cookie", cookies);
      } else {
        System.out.println("Cookies was not null");
        cookies.add(jSessionId.toString());
      }
    }

    port.hello("Kyle");
  }
View Full Code Here

TOP

Related Classes of com.sun.xml.ws.transport.http.client.HttpCookie$CookieAttributeAssignor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.