JSR-356 - Making WebSocketUpgradeFilter an attribute in the ServletContext

This commit is contained in:
Joakim Erdfelt 2013-07-25 09:43:47 -07:00
parent 9c41f57b7c
commit b549410932
2 changed files with 10 additions and 1 deletions

View File

@ -49,7 +49,11 @@ public class WebSocketConfiguration extends AbstractConfiguration
String pathSpec = "/*";
context.addFilter(fholder,pathSpec,EnumSet.of(DispatcherType.REQUEST));
LOG.debug("Adding {} mapped to {} to {}",filter,pathSpec,context);
// Store reference to the WebSocketUpgradeFilter
context.setAttribute(WebSocketUpgradeFilter.class.getName(),filter);
// Store reference to the ServerContainer
ServerContainer container = new ServerContainer(filter);
filter.setWebSocketServerFactoryListener(container);
context.setAttribute(JAVAX_WEBSOCKET_SERVER_CONTAINER,container);

View File

@ -64,7 +64,7 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
{
factory.cleanup();
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
@ -138,6 +138,11 @@ public class WebSocketUpgradeFilter implements Filter, MappedWebSocketCreator, D
pathmap.dump(out,indent + " ");
}
public WebSocketServerFactory getFactory()
{
return factory;
}
@ManagedAttribute(value = "mappings", readonly = true)
@Override
public PathMappings<WebSocketCreator> getMappings()