I am trying to forward the initial websocket http request coming in via a Servlet filter with the forward method (I want to cut off the first path segment):

 

    final String requestUri = HttpServletRequest.class.cast(servletRequest).getRequestURI();

    final String newRequestUri = requestUri.substring(requestUri.indexOf("/", 1));

    servletRequest.getRequestDispatcher(newRequestUri).forward(servletRequest, servletResponse);

 

The filter is triggered successfully, but the websocket is not initialized instead 404 is returned.

 

Is this correct according to spec? How can I forward such requests?

 

Thankx

Lukas