tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddfas <todd...@gmail.com>
Subject Re: Tomcat 8 Websocket API - Cookies & Headers
Date Fri, 23 Aug 2013 16:03:40 GMT
Thanks very much for the quick response Niki!

I went down the configurator path too, but then I could not find a way
to pass the cookie values into the ServerEndPoint.onOpen where I need
to use it. I tried passing it via session.getRequestParameterMap() but
that is a Collections.unmodifiableMap(). In my scenario the
session.getHttpSession() is NULL so I can't put it in there. I didn't
like the idea of putting it in ThreadLocal (unless I am guaranteed by
the spec that ServerEndPoint.onOpen is always called on the same
thread that processes the handshake).

That was when I started thinking I must be missing something simple.
Any suggestions?

Thanks,
Todd


On Thu, Aug 22, 2013 at 10:12 PM, Niki Dokovski <nickytd@gmail.com> wrote:
> On Fri, Aug 23, 2013 at 2:58 AM, toddfas <toddfas@gmail.com> wrote:
>
>> I'm trying to figure out how to get access to the cookies and headers
>> passed up in the Websocket handshake request on Tomcat 8.
>>
>> In Tomcat 7 the whole HttpServletRequest was passed into the
>> WebSocketServlet. createWebSocketInbound method so it was easy to grab
>> from the request headers. In Tomcat 8 the querystring and URI are both
>> exposed by the javax.websocket.Session passed to
>> ServerEndPoint.onOpen, but I don't see a mechanism for getting the
>> cookies or headers.
>>
>
> You can supply an extension of
> http://docs.oracle.com/javaee/7/api/javax/websocket/server/ServerEndpointConfig.Configurator.html
>  and get
> http://docs.oracle.com/javaee/7/api/javax/websocket/server/HandshakeRequest.html
> through
> modifyHandshake invoked by the container during processing of client 'GET'
> handshake message. Handshake request containes methods for inspecting the
> http request parameters and headers.
>
>
>
>> We are integrating Websocket connections into an existing web app and
>> want to use the cookies set by our web app in the Websocket connection
>> process.
>>
>> Thanks for any insight.
>> Todd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message