com.sun.grizzly.websockets
Class WebSocketEngine

java.lang.Object
  extended by com.sun.grizzly.websockets.WebSocketEngine

public class WebSocketEngine
extends Object


Field Summary
static String CLIENT_WS_ORIGIN_HEADER
           
static String CONNECTION
           
static int DEFAULT_TIMEOUT
           
static Version DEFAULT_VERSION
           
static int INITIAL_BUFFER_SIZE
           
static int MASK_SIZE
           
static String RESPONSE_CODE_HEADER
           
static String RESPONSE_CODE_MESSAGE
           
static String RESPONSE_CODE_VALUE
           
static String SEC_WS_ACCEPT
           
static String SEC_WS_EXTENSIONS_HEADER
           
static String SEC_WS_KEY_HEADER
           
static String SEC_WS_ORIGIN_HEADER
           
static String SEC_WS_PROTOCOL_HEADER
           
static String SEC_WS_VERSION
           
static String SERVER_KEY_HASH
           
static String UPGRADE
           
static String WEBSOCKET
           
 
Method Summary
 WebSocketApplication getApplication(Request request)
           
 WebSocketApplication getApplication(Request request, boolean checkPrivateMapper)
           
static WebSocketEngine getEngine()
           
static ProtocolHandler loadHandler(MimeHeaders headers)
           
 void register(String contextPath, String urlPattern, WebSocketApplication app)
          Register a WebSocketApplication to a specific context path and url pattern.
 void register(WebSocketApplication app)
          Deprecated. Use register(String, String, WebSocketApplication)
static byte[] toArray(long length)
           
static long toLong(byte[] bytes, int start, int end)
           
 void unregister(WebSocketApplication app)
          When invoked, the all websockets currently connected to the application will be closed.
 boolean upgrade(AsyncExecutor asyncExecutor)
           
 boolean upgrade(AsyncExecutor asyncExecutor, Mapper mapper)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEC_WS_ACCEPT

public static final String SEC_WS_ACCEPT
See Also:
Constant Field Values

SEC_WS_KEY_HEADER

public static final String SEC_WS_KEY_HEADER
See Also:
Constant Field Values

SEC_WS_ORIGIN_HEADER

public static final String SEC_WS_ORIGIN_HEADER
See Also:
Constant Field Values

SEC_WS_PROTOCOL_HEADER

public static final String SEC_WS_PROTOCOL_HEADER
See Also:
Constant Field Values

SEC_WS_EXTENSIONS_HEADER

public static final String SEC_WS_EXTENSIONS_HEADER
See Also:
Constant Field Values

SEC_WS_VERSION

public static final String SEC_WS_VERSION
See Also:
Constant Field Values

WEBSOCKET

public static final String WEBSOCKET
See Also:
Constant Field Values

RESPONSE_CODE_HEADER

public static final String RESPONSE_CODE_HEADER
See Also:
Constant Field Values

RESPONSE_CODE_MESSAGE

public static final String RESPONSE_CODE_MESSAGE
See Also:
Constant Field Values

RESPONSE_CODE_VALUE

public static final String RESPONSE_CODE_VALUE
See Also:
Constant Field Values

UPGRADE

public static final String UPGRADE
See Also:
Constant Field Values

CONNECTION

public static final String CONNECTION
See Also:
Constant Field Values

CLIENT_WS_ORIGIN_HEADER

public static final String CLIENT_WS_ORIGIN_HEADER
See Also:
Constant Field Values

DEFAULT_VERSION

public static final Version DEFAULT_VERSION

INITIAL_BUFFER_SIZE

public static final int INITIAL_BUFFER_SIZE
See Also:
Constant Field Values

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT

SERVER_KEY_HASH

public static final String SERVER_KEY_HASH
See Also:
Constant Field Values

MASK_SIZE

public static final int MASK_SIZE
See Also:
Constant Field Values
Method Detail

getEngine

public static WebSocketEngine getEngine()

toArray

public static byte[] toArray(long length)

toLong

public static long toLong(byte[] bytes,
                          int start,
                          int end)

loadHandler

public static ProtocolHandler loadHandler(MimeHeaders headers)

getApplication

public WebSocketApplication getApplication(Request request)

getApplication

public WebSocketApplication getApplication(Request request,
                                           boolean checkPrivateMapper)

upgrade

public boolean upgrade(AsyncExecutor asyncExecutor)

upgrade

public boolean upgrade(AsyncExecutor asyncExecutor,
                       Mapper mapper)

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)
Deprecated. Use register(String, String, WebSocketApplication)


unregister

public void unregister(WebSocketApplication app)
When invoked, the all websockets currently connected to the application will be closed.

Parameters:
app - the application to de-register


Copyright © 2013 Oracle Corporation. All Rights Reserved.