https://issues.apache.org/bugzilla/show_bug.cgi?id=55824
Bug ID: 55824 Summary: HandshakeRequest.getHttpSocket() may return null at ServerEndpointConfig.Configurator.modifyHandshake time Product: Tomcat 8 Version: 8.0.0-RC5 Hardware: PC OS: OpenBSD Status: NEW Severity: normal Priority: P2 Component: WebSocket Assignee: dev@tomcat.apache.org Reporter: niklas+apa...@appli.se Created attachment 31081 --> https://issues.apache.org/bugzilla/attachment.cgi?id=31081&action=edit A test websocket endpoint implementation, a JS client to test it, and a context.xml for container deployment. In a webapp with just a websocket implementation, an HttpSession does not seem to be created in time for the modifyHandshake call. Attached is a test to show this. I have no idea if there are any downsides to it but I have a proposed fix that does solve my test case, call the HttpServletRequest.getSession(boolean create) method with a true parameter instead of false from the WsHandshakeRequest constructor: Index: /d/sd0h/h/niklas/java/workspace-1/Tomcat8/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java =================================================================== --- /d/sd0h/h/niklas/java/workspace-1/Tomcat8/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java (revision 1546042) +++ /d/sd0h/h/niklas/java/workspace-1/Tomcat8/java/org/apache/tomcat/websocket/server/WsHandshakeRequest.java (working copy) @@ -51,7 +51,7 @@ queryString = request.getQueryString(); userPrincipal = request.getUserPrincipal(); - httpSession = request.getSession(false); + httpSession = request.getSession(true); // URI StringBuilder sb = new StringBuilder(request.getRequestURI()); -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org