Johan,

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

EndpointConfig.getUserProperties().put("ServletContext",
 ((HttpSession)request.getHttpSession()).getServletContext());

??

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: 
> http://stackoverflow.com/questions/17936440/accessing-httpsession-from-httpservletrequest-in-a-web-socket-socketendpoint
>
>  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
oversight.

-chris

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

Reply via email to