public class WebSocketServerFactory extends ContainerLifeCycle implements WebSocketCreator, WebSocketServletFactory, SessionListener
AbstractLifeCycle.AbstractLifeCycleListener
WebSocketServletFactory.Loader
Container.InheritedListener, Container.Listener
LifeCycle.Listener
Constructor and Description |
---|
WebSocketServerFactory() |
WebSocketServerFactory(ByteBufferPool bufferPool) |
WebSocketServerFactory(WebSocketPolicy policy) |
WebSocketServerFactory(WebSocketPolicy policy,
ByteBufferPool bufferPool) |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public WebSocketServerFactory()
public WebSocketServerFactory(WebSocketPolicy policy)
public WebSocketServerFactory(ByteBufferPool bufferPool)
public WebSocketServerFactory(WebSocketPolicy policy, ByteBufferPool bufferPool)
public boolean acceptWebSocket(HttpServletRequest request, HttpServletResponse response) throws IOException
acceptWebSocket
in interface WebSocketServletFactory
IOException
public boolean acceptWebSocket(WebSocketCreator creator, HttpServletRequest request, HttpServletResponse response) throws IOException
acceptWebSocket
in interface WebSocketServletFactory
IOException
public void addSessionFactory(SessionFactory sessionFactory)
public void cleanup()
cleanup
in interface WebSocketServletFactory
protected void shutdownAllConnections()
public WebSocketServletFactory createFactory(WebSocketPolicy policy)
createFactory
in interface WebSocketServletFactory
public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
createWebSocket
in interface WebSocketCreator
req
- the request detailsresp
- the response detailsprotected void doStop() throws Exception
ContainerLifeCycle
doStop
in class ContainerLifeCycle
Exception
public WebSocketCreator getCreator()
getCreator
in interface WebSocketServletFactory
public EventDriverFactory getEventDriverFactory()
public ExtensionFactory getExtensionFactory()
getExtensionFactory
in interface WebSocketServletFactory
public Set<WebSocketSession> getOpenSessions()
public WebSocketPolicy getPolicy()
WebSocketServletFactory
Note: individual WebSocket implementations can override some of the values in here by using the @WebSocket
annotation.
getPolicy
in interface WebSocketServletFactory
public void init() throws Exception
init
in interface WebSocketServletFactory
Exception
public boolean isUpgradeRequest(HttpServletRequest request, HttpServletResponse response)
isUpgradeRequest
in interface WebSocketServletFactory
public void onSessionClosed(WebSocketSession session)
onSessionClosed
in interface SessionListener
public void onSessionOpened(WebSocketSession session)
onSessionOpened
in interface SessionListener
public void register(Class<?> websocketPojo)
WebSocketServletFactory
WebSocketCreator
.
Note: only required if using the default WebSocketCreator
provided by this factory.
register
in interface WebSocketServletFactory
websocketPojo
- the class to instantiate for each incoming websocket upgrade request.public void setCreator(WebSocketCreator creator)
setCreator
in interface WebSocketServletFactory
Copyright © 1995-2015 Webtide. All Rights Reserved.