public class WebSocketServerFactory extends ContainerLifeCycle implements WebSocketCreator, WebSocketContainerScope, 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) |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptWebSocket(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
boolean |
acceptWebSocket(WebSocketCreator creator,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
addSessionFactory(SessionFactory sessionFactory) |
void |
cleanup() |
WebSocketServletFactory |
createFactory(WebSocketPolicy policy) |
Object |
createWebSocket(ServletUpgradeRequest req,
ServletUpgradeResponse resp)
Default Creator logic
|
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
ByteBufferPool |
getBufferPool()
The configured Container Buffer Pool.
|
WebSocketCreator |
getCreator() |
EventDriverFactory |
getEventDriverFactory() |
Executor |
getExecutor()
Executor in use by the container.
|
ExtensionFactory |
getExtensionFactory() |
DecoratedObjectFactory |
getObjectFactory()
Object Factory used to create objects.
|
Set<WebSocketSession> |
getOpenSessions() |
WebSocketPolicy |
getPolicy()
The policy the container is running on.
|
SslContextFactory |
getSslContextFactory()
The SslContextFactory in use by the container.
|
void |
init(javax.servlet.ServletContext context) |
void |
init(ServletContextHandler context) |
boolean |
isUpgradeRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
onSessionClosed(WebSocketSession session) |
void |
onSessionOpened(WebSocketSession session) |
protected String[] |
parseProtocols(String protocol) |
void |
register(Class<?> websocketPojo)
Register a websocket class pojo with the default
WebSocketCreator . |
void |
setCreator(WebSocketCreator creator) |
protected void |
shutdownAllConnections() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, 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(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
acceptWebSocket
in interface WebSocketServletFactory
IOException
public boolean acceptWebSocket(WebSocketCreator creator, javax.servlet.http.HttpServletRequest request, javax.servlet.http.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 doStart() throws Exception
ContainerLifeCycle
doStart
in class ContainerLifeCycle
Exception
protected void doStop() throws Exception
ContainerLifeCycle
doStop
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 Set<WebSocketSession> getOpenSessions()
public WebSocketPolicy getPolicy()
WebSocketContainerScope
getPolicy
in interface WebSocketContainerScope
getPolicy
in interface WebSocketServletFactory
public SslContextFactory getSslContextFactory()
WebSocketContainerScope
getSslContextFactory
in interface WebSocketContainerScope
public void init(ServletContextHandler context) throws javax.servlet.ServletException
javax.servlet.ServletException
public void init(javax.servlet.ServletContext context) throws javax.servlet.ServletException
init
in interface WebSocketServletFactory
javax.servlet.ServletException
public boolean isUpgradeRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.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.