-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It is not easy to get to the ServletContext in a websocket session #217
Comments
@glassfishrobot Commented |
@glassfishrobot Commented
If provided in this manner, getting a ServletContext is as simple as, using a Session as an example, this:
|
@glassfishrobot Commented |
|
This is covered by #238 |
You could use a Configurator for this:
public class GetServletContextConfigurator extends ServerEndpointConfig.Configurator
{
@OverRide
public void modifyHandshake(ServerEndpointConfig config,
HandshakeRequest request,
HandshakeResponse response)
{ EndpointConfig.getUserProperties().put("ServletContext",((HttpSession)request.getHttpSession()).getServletContext()); }
}
But that doesn't work for me, because there is no http session..
and the above call does not create it. It could be made that that always just creates a session, but can then a jsessionid cookie be send back over that upgraded websocket request so that the browser does use that?
I need the ServletContext to read files and that kind of stuff right from the WAR. Its impossible to get to that directory (or war file itself if it is not extracted) in side a websocket.
I think what we need is
EndpointConfig.getUserProperties().put("ServletContext",request.getServletContext());
or something like that.
Affected Versions
[1.0]
The text was updated successfully, but these errors were encountered: