tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Accessing ServletContext from WebSocket endpoint
Date Sat, 07 Dec 2013 03:48:33 GMT

On 12/6/13, 3:53 AM, Johan Compagner wrote:
> I ask the same question yes, but i still don't see a way to really
> do that nicely through an EndpointConfig



It's ugly, but, as someone said, it does require that you do your own
plumbing. There may be a cleaner way to get the servlet context e.g.
not having to create an HttpSession. It seems clear that
HandshareRequest ought to have a getServletContext method as well as a
getSession method.

> So if somebody has a nice example that gets the Servletcontext that
> i then can access in the websocket instance that would be nice This
> example should be something different then what is given here: 
>  because i only see currently api to get the HttpSession and then
> through that the ServletContext, problem is that there is no http
> session..

Aah... if there is no session, getHttpSession doesn't automatically
create one(). Boo.

Clearly this is an opportunity for the EG to step in and correct an


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message