org.eclipse.jetty.websocket
类 WebSocketFactory

java.lang.Object
  继承者 org.eclipse.jetty.util.component.AbstractLifeCycle
      继承者 org.eclipse.jetty.websocket.WebSocketFactory
所有已实现的接口:
LifeCycle

public class WebSocketFactory
extends AbstractLifeCycle

Factory to create WebSocket connections


嵌套类摘要
static interface WebSocketFactory.Acceptor
           
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口
AbstractLifeCycle.AbstractLifeCycleListener
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口
LifeCycle.Listener
 
字段摘要
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
构造方法摘要
WebSocketFactory(WebSocketFactory.Acceptor acceptor)
           
WebSocketFactory(WebSocketFactory.Acceptor acceptor, int bufferSize)
           
WebSocketFactory(WebSocketFactory.Acceptor acceptor, int bufferSize, int minVersion)
           
 
方法摘要
 boolean acceptWebSocket(HttpServletRequest request, HttpServletResponse response)
           
protected  boolean addConnection(WebSocketServletConnection connection)
           
protected  void closeConnections()
           
protected  void doStop()
           
 int getBufferSize()
          Get the bufferSize.
 Map<String,Class<? extends Extension>> getExtensionClassesMap()
           
 int getMaxBinaryMessageSize()
           
 long getMaxIdleTime()
          Get the maxIdleTime.
 int getMaxTextMessageSize()
           
 int getMinVersion()
           
 List<Extension> initExtensions(List<String> requested, int maxDataOpcodes, int maxControlOpcodes, int maxReservedBits)
           
protected  String[] parseProtocols(String protocol)
           
protected  boolean removeConnection(WebSocketServletConnection connection)
           
 void setBufferSize(int bufferSize)
          Set the bufferSize.
 void setMaxBinaryMessageSize(int maxBinaryMessageSize)
          Set the initial maximum binary message size for a connection.
 void setMaxIdleTime(int maxIdleTime)
          Set the maxIdleTime.
 void setMaxTextMessageSize(int maxTextMessageSize)
          Set the initial maximum text message size for a connection.
 void setMinVersion(int minVersion)
           
 void upgrade(HttpServletRequest request, HttpServletResponse response, WebSocket websocket, String protocol)
          Upgrade the request/response to a WebSocket Connection.
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法
addLifeCycleListener, doStart, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

WebSocketFactory

public WebSocketFactory(WebSocketFactory.Acceptor acceptor)

WebSocketFactory

public WebSocketFactory(WebSocketFactory.Acceptor acceptor,
                        int bufferSize)

WebSocketFactory

public WebSocketFactory(WebSocketFactory.Acceptor acceptor,
                        int bufferSize,
                        int minVersion)
方法详细信息

getMinVersion

public int getMinVersion()

setMinVersion

public void setMinVersion(int minVersion)
参数:
minVersion - The minimum support version (default RCF6455.VERSION == 13 )

getExtensionClassesMap

public Map<String,Class<? extends Extension>> getExtensionClassesMap()
返回:
A modifiable map of extension name to extension class

getMaxIdleTime

public long getMaxIdleTime()
Get the maxIdleTime.

返回:
the maxIdleTime

setMaxIdleTime

public void setMaxIdleTime(int maxIdleTime)
Set the maxIdleTime.

参数:
maxIdleTime - the maxIdleTime to set

getBufferSize

public int getBufferSize()
Get the bufferSize.

返回:
the bufferSize

setBufferSize

public void setBufferSize(int bufferSize)
Set the bufferSize.

参数:
bufferSize - the bufferSize to set

getMaxTextMessageSize

public int getMaxTextMessageSize()
返回:
The initial maximum text message size (in characters) for a connection

setMaxTextMessageSize

public void setMaxTextMessageSize(int maxTextMessageSize)
Set the initial maximum text message size for a connection. This can be changed by the application calling WebSocket.Connection.setMaxTextMessageSize(int).

参数:
maxTextMessageSize - The default maximum text message size (in characters) for a connection

getMaxBinaryMessageSize

public int getMaxBinaryMessageSize()
返回:
The initial maximum binary message size (in bytes) for a connection

setMaxBinaryMessageSize

public void setMaxBinaryMessageSize(int maxBinaryMessageSize)
Set the initial maximum binary message size for a connection. This can be changed by the application calling WebSocket.Connection.setMaxBinaryMessageSize(int).

参数:
maxBinaryMessageSize - The default maximum binary message size (in bytes) for a connection

doStop

protected void doStop()
               throws Exception
覆盖:
AbstractLifeCycle 中的 doStop
抛出:
Exception

upgrade

public void upgrade(HttpServletRequest request,
                    HttpServletResponse response,
                    WebSocket websocket,
                    String protocol)
             throws IOException
Upgrade the request/response to a WebSocket Connection.

This method will not normally return, but will instead throw a UpgradeConnectionException, to exit HTTP handling and initiate WebSocket handling of the connection.

参数:
request - The request to upgrade
response - The response to upgrade
websocket - The websocket handler implementation to use
protocol - The websocket protocol
抛出:
IOException - in case of I/O errors

parseProtocols

protected String[] parseProtocols(String protocol)

acceptWebSocket

public boolean acceptWebSocket(HttpServletRequest request,
                               HttpServletResponse response)
                        throws IOException
抛出:
IOException

initExtensions

public List<Extension> initExtensions(List<String> requested,
                                      int maxDataOpcodes,
                                      int maxControlOpcodes,
                                      int maxReservedBits)

addConnection

protected boolean addConnection(WebSocketServletConnection connection)

removeConnection

protected boolean removeConnection(WebSocketServletConnection connection)

closeConnections

protected void closeConnections()


Copyright © 2013. All Rights Reserved.