org.eclipse.jetty.websocket
Class WebSocketFactory

java.lang.Object
  extended by org.eclipse.jetty.websocket.WebSocketFactory

public class WebSocketFactory
extends Object

Factory to create WebSocket connections


Nested Class Summary
static interface WebSocketFactory.Acceptor
           
 
Constructor Summary
WebSocketFactory(WebSocketFactory.Acceptor acceptor)
           
WebSocketFactory(WebSocketFactory.Acceptor acceptor, int bufferSize)
           
 
Method Summary
 boolean acceptWebSocket(HttpServletRequest request, HttpServletResponse response)
           
 int getBufferSize()
          Get the bufferSize.
 long getMaxIdleTime()
          Get the maxIdleTime.
static String[] parseProtocols(String protocol)
           
 void setBufferSize(int bufferSize)
          Set the bufferSize.
 void setMaxIdleTime(int maxIdleTime)
          Set the maxIdleTime.
 void upgrade(HttpServletRequest request, HttpServletResponse response, WebSocket websocket, String origin, String protocol)
          Upgrade the request/response to a WebSocket Connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSocketFactory

public WebSocketFactory(WebSocketFactory.Acceptor acceptor)

WebSocketFactory

public WebSocketFactory(WebSocketFactory.Acceptor acceptor,
                        int bufferSize)
Method Detail

getMaxIdleTime

public long getMaxIdleTime()
Get the maxIdleTime.

Returns:
the maxIdleTime

setMaxIdleTime

public void setMaxIdleTime(int maxIdleTime)
Set the maxIdleTime.

Parameters:
maxIdleTime - the maxIdleTime to set

getBufferSize

public int getBufferSize()
Get the bufferSize.

Returns:
the bufferSize

setBufferSize

public void setBufferSize(int bufferSize)
Set the bufferSize.

Parameters:
bufferSize - the bufferSize to set

upgrade

public void upgrade(HttpServletRequest request,
                    HttpServletResponse response,
                    WebSocket websocket,
                    String origin,
                    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.

Parameters:
request - The request to upgrade
response - The response to upgrade
websocket - The websocket handler implementation to use
origin - The origin of the websocket connection
protocol - The websocket protocol
Throws:
IOException - in case of I/O errors

parseProtocols

public static String[] parseProtocols(String protocol)

acceptWebSocket

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


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.