java.lang.Object
org.glassfish.grizzly.websockets.WebSocketEngine

public class WebSocketEngine extends Object
WebSockets engine implementation (singleton), which handles WebSocketApplications registration, responsible for client and server handshake validation.
Author:
Alexey Stashok
See Also:
  • Field Details

    • DEFAULT_VERSION

      public static final Version DEFAULT_VERSION
    • DEFAULT_TIMEOUT

      public static final int DEFAULT_TIMEOUT
      See Also:
  • Method Details

    • getEngine

      public static WebSocketEngine getEngine()
    • getApplication

      public WebSocketApplication getApplication(org.glassfish.grizzly.http.HttpRequestPacket request)
    • upgrade

      public boolean upgrade(org.glassfish.grizzly.filterchain.FilterChainContext ctx, org.glassfish.grizzly.http.HttpContent requestContent) throws IOException
      Throws:
      IOException
    • upgrade

      public boolean upgrade(org.glassfish.grizzly.filterchain.FilterChainContext ctx, org.glassfish.grizzly.http.HttpContent requestContent, org.glassfish.grizzly.http.server.util.Mapper mapper) throws IOException
      Throws:
      IOException
    • loadHandler

      public static ProtocolHandler loadHandler(org.glassfish.grizzly.http.util.MimeHeaders headers)
    • register

      public void register(String contextPath, String urlPattern, WebSocketApplication app)
      Register a WebSocketApplication to a specific context path and url pattern. If you wish to associate this application with the root context, use an empty string for the contextPath argument.
       Examples:
       // WS application will be invoked:
       // ws://localhost:8080/echo
       // WS application will not be invoked:
       // ws://localhost:8080/foo/echo
       // ws://localhost:8080/echo/some/path
       register("", "/echo", webSocketApplication);
      
       // WS application will be invoked:
       // ws://localhost:8080/echo
       // ws://localhost:8080/echo/some/path
       // WS application will not be invoked:
       // ws://localhost:8080/foo/echo
       register("", "/echo/*", webSocketApplication);
      
       // WS application will be invoked:
       // ws://localhost:8080/context/echo
      
       // WS application will not be invoked:
       // ws://localhost:8080/echo
       // ws://localhost:8080/context/some/path
       register("/context", "/echo", webSocketApplication);
       
      Parameters:
      contextPath - the context path (per servlet rules)
      urlPattern - url pattern (per servlet rules)
      app - the WebSocket application.
    • register

      @Deprecated public void register(WebSocketApplication app)
    • unregister

      public void unregister(WebSocketApplication app)
    • unregisterAll

      public void unregisterAll()
      Un-registers all WebSocketApplication instances with the WebSocketEngine.