users@websocket-spec.java.net

[jsr356-users] Headers / Cookies in ClientEndpointConfiguration

From: Joakim Erdfelt <joakim_at_erdfelt.com>
Date: Mon, 05 Nov 2012 07:43:00 -0700

In ClientEndpointConfiguration, can we see some (simple) means to
control the headers of the outgoing upgrade request?

Mainly for authentication reasons.

Some ideas for the interface.

/**
  * Sets optional CookieStore for outgoing requests.
  * <p>
  * If unset, no cookies are set on outgoing request.
  * @param cookieStore the CookieStore to pull cookies from.
  */
void setCookieStore(java.net.CookieStore cookieStore);

/**
  * Get CookieStore in use for outgoing requests.
  * @return the CookieStore.
  */
java.net.CookieStore getCookieStore();

/**
  * Set an arbitrary header on the outgoing request.
  * <p>
  * Note: will replace any existing headers of the same name
  * <p>
  * Some header names are reserved for the ClientContainer to manage and
will trigger a RuntimeException.
  * Reserved Headers:
  * Cookie
  * Upgrade
  * Host
  * Connection
  * Sec-WebSocket-*
  *
  * @param name the name of the header
  * @param value the value of the header. A null value will clear the
header.
  */
void setHeader(String name, String value);

- Joakim