public class WebSocketServerFactory extends ContainerLifeCycle implements WebSocketCreator, WebSocketContainerScope, WebSocketServletFactory
AbstractLifeCycle.AbstractLifeCycleListener
WebSocketServletFactory.Loader
Container.InheritedListener, Container.Listener
LifeCycle.Listener
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
Modifier | Constructor and Description |
---|---|
|
WebSocketServerFactory(ServletContext context) |
|
WebSocketServerFactory(ServletContext context,
ByteBufferPool bufferPool) |
|
WebSocketServerFactory(ServletContext context,
WebSocketPolicy policy)
Entry point for
WebSocketServletFactory.Loader |
|
WebSocketServerFactory(ServletContext context,
WebSocketPolicy policy,
ByteBufferPool bufferPool) |
protected |
WebSocketServerFactory(WebSocketPolicy policy,
Executor executor,
ByteBufferPool bufferPool)
Protected entry point for
WebSocketHandler |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, doStop, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isRunning
start, stop
public WebSocketServerFactory(ServletContext context)
public WebSocketServerFactory(ServletContext context, ByteBufferPool bufferPool)
public WebSocketServerFactory(ServletContext context, WebSocketPolicy policy)
WebSocketServletFactory.Loader
context
- the servlet contextpolicy
- the policy to usepublic WebSocketServerFactory(ServletContext context, WebSocketPolicy policy, ByteBufferPool bufferPool)
protected WebSocketServerFactory(WebSocketPolicy policy, Executor executor, ByteBufferPool bufferPool)
WebSocketHandler
policy
- the policy to useexecutor
- the executor to usebufferPool
- the buffer pool to usepublic void addSessionListener(WebSocketSession.Listener listener)
public void removeSessionListener(WebSocketSession.Listener listener)
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 Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
createWebSocket
in interface WebSocketCreator
req
- the request detailsresp
- the response detailsprotected void doStart() throws Exception
ContainerLifeCycle
doStart
in class ContainerLifeCycle
Exception
public ByteBufferPool getBufferPool()
WebSocketContainerScope
getBufferPool
in interface WebSocketContainerScope
public WebSocketCreator getCreator()
getCreator
in interface WebSocketServletFactory
public Executor getExecutor()
WebSocketContainerScope
getExecutor
in interface WebSocketContainerScope
public DecoratedObjectFactory getObjectFactory()
WebSocketContainerScope
getObjectFactory
in interface WebSocketContainerScope
public EventDriverFactory getEventDriverFactory()
public ExtensionFactory getExtensionFactory()
getExtensionFactory
in interface WebSocketServletFactory
public Collection<WebSocketSession> getOpenSessions()
public WebSocketPolicy getPolicy()
WebSocketContainerScope
getPolicy
in interface WebSocketContainerScope
getPolicy
in interface WebSocketServletFactory
public SslContextFactory getSslContextFactory()
WebSocketContainerScope
getSslContextFactory
in interface WebSocketContainerScope
public boolean isUpgradeRequest(HttpServletRequest request, HttpServletResponse response)
isUpgradeRequest
in interface WebSocketServletFactory
public void onSessionOpened(WebSocketSession session)
WebSocketContainerScope
onSessionOpened
in interface WebSocketContainerScope
session
- the session that was openedpublic void onSessionClosed(WebSocketSession session)
WebSocketContainerScope
onSessionClosed
in interface WebSocketContainerScope
session
- the session that was closedpublic 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–2017 Webtide. All rights reserved.