org.eclipse.jetty.websocket
public class WebSocketFactory extends AbstractLifeCycle
Modifier and Type | Class and Description |
---|---|
static interface |
WebSocketFactory.Acceptor |
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
Constructor and Description |
---|
WebSocketFactory(WebSocketFactory.Acceptor acceptor) |
WebSocketFactory(WebSocketFactory.Acceptor acceptor,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptWebSocket(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected boolean |
addConnection(WebSocketServletConnection connection) |
protected void |
closeConnections() |
protected void |
doStop() |
int |
getBufferSize()
Get the bufferSize.
|
java.util.Map<java.lang.String,java.lang.Class<? extends Extension>> |
getExtensionClassesMap() |
int |
getMaxBinaryMessageSize() |
long |
getMaxIdleTime()
Get the maxIdleTime.
|
int |
getMaxTextMessageSize() |
java.util.List<Extension> |
initExtensions(java.util.List<java.lang.String> requested,
int maxDataOpcodes,
int maxControlOpcodes,
int maxReservedBits) |
protected java.lang.String[] |
parseProtocols(java.lang.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 |
upgrade(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
WebSocket websocket,
java.lang.String protocol)
Upgrade the request/response to a WebSocket Connection.
|
addLifeCycleListener, doStart, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public WebSocketFactory(WebSocketFactory.Acceptor acceptor)
public WebSocketFactory(WebSocketFactory.Acceptor acceptor, int bufferSize)
public java.util.Map<java.lang.String,java.lang.Class<? extends Extension>> getExtensionClassesMap()
public long getMaxIdleTime()
public void setMaxIdleTime(int maxIdleTime)
maxIdleTime
- the maxIdleTime to setpublic int getBufferSize()
public void setBufferSize(int bufferSize)
bufferSize
- the bufferSize to setpublic int getMaxTextMessageSize()
public void setMaxTextMessageSize(int maxTextMessageSize)
WebSocket.Connection.setMaxTextMessageSize(int)
.maxTextMessageSize
- The default maximum text message size (in characters) for a connectionpublic int getMaxBinaryMessageSize()
public void setMaxBinaryMessageSize(int maxBinaryMessageSize)
WebSocket.Connection.setMaxBinaryMessageSize(int)
.maxBinaryMessageSize
- The default maximum binary message size (in bytes) for a connectionprotected void doStop() throws java.lang.Exception
doStop
in class AbstractLifeCycle
java.lang.Exception
public void upgrade(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, WebSocket websocket, java.lang.String protocol) throws java.io.IOException
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 upgraderesponse
- The response to upgradewebsocket
- The websocket handler implementation to useprotocol
- The websocket protocoljava.io.IOException
- in case of I/O errorsprotected java.lang.String[] parseProtocols(java.lang.String protocol)
public boolean acceptWebSocket(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
java.io.IOException
public java.util.List<Extension> initExtensions(java.util.List<java.lang.String> requested, int maxDataOpcodes, int maxControlOpcodes, int maxReservedBits)
protected boolean addConnection(WebSocketServletConnection connection)
protected boolean removeConnection(WebSocketServletConnection connection)
protected void closeConnections()
Copyright © 2014. All Rights Reserved.