users@grizzly.java.net

Re: WebSockets accessing request and response headers.

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Wed, 29 Sep 2010 16:58:23 +0200

Hi guys,

in Grizzly 2.0 RC2 we've exposed HttpHeader attribute, which could be
accessed like:

WebSocket.getMeta().getHandshakeHeader()

WBR,
Alexey.

On Sep 29, 2010, at 16:26 , Vincent Nonnenmacher wrote:

> On 27/09/10 06:11, Richard Zschech wrote:
>>
>> Hi,
>>
>> I’m looking at the latest WebSockets code linked from here and have
>> a few questions: http://blogs.sun.com/oleksiys/entry/grizzly_2_0_websockets_support
>>
>> How do I access the HTTP request and response headers? Surely I
>> should be able to access the cookie information.
>>
>> How do I establish a HTTP session when a WebSocket requests is
>> received? Surely I should be able to do this.
>>
>> WebKit sets the cookie headers correctly:
>>
>> http://trac.webkit.org/browser/trunk/WebCore/websockets/WebSocketHandshake.cpp#L275
>> http://trac.webkit.org/browser/trunk/WebCore/websockets/WebSocketHandshake.cpp#L565
>>
>> Perhaps the WebSocketApplication should get a HttpServletRequest
>> and HttpServletResponse as parameters to the createWebSocket method?
>>
>>
> it would be great if there is no more dependencies than strictely
> required on HttpServlet as
> this cause problems in environements like Restlet for example where
> there could be
> deployment options with no servlet wrapping at all, still having
> Grizzly used as the
> base HTTPServer.
>
> A Grizzly enable websockets usable directly from the Restlet Engine
> using Grizzly would
> be a great option for HTML5 enabled clients
>