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()
Entry point for Spring Boot's MockMVC framework
|
|
WebSocketServerFactory(javax.servlet.ServletContext context) |
|
WebSocketServerFactory(javax.servlet.ServletContext context,
ByteBufferPool bufferPool) |
|
WebSocketServerFactory(javax.servlet.ServletContext context,
WebSocketPolicy policy)
Entry point for
WebSocketServletFactory.Loader |
|
WebSocketServerFactory(javax.servlet.ServletContext context,
WebSocketPolicy policy,
ByteBufferPool bufferPool) |
protected |
WebSocketServerFactory(WebSocketPolicy policy,
java.util.concurrent.Executor executor,
ByteBufferPool bufferPool)
Protected entry point for
WebSocketHandler |
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 |
addSessionListener(WebSocketSession.Listener listener) |
java.lang.Object |
createWebSocket(ServletUpgradeRequest req,
ServletUpgradeResponse resp)
Default Creator logic
|
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected DecoratedObjectFactory |
findDecorator()
Attempt to find the DecoratedObjectFactory that should be used.
|
protected java.util.concurrent.Executor |
findExecutor()
Attempt to find the Executor that should be used.
|
ByteBufferPool |
getBufferPool()
The configured Container Buffer Pool.
|
WebSocketCreator |
getCreator() |
EventDriverFactory |
getEventDriverFactory() |
java.util.concurrent.Executor |
getExecutor()
Executor in use by the container.
|
ExtensionFactory |
getExtensionFactory() |
DecoratedObjectFactory |
getObjectFactory()
Object Factory used to create objects.
|
java.util.Collection<WebSocketSession> |
getOpenSessions() |
WebSocketPolicy |
getPolicy()
The policy the container is running on.
|
SslContextFactory |
getSslContextFactory()
The SslContextFactory in use by the container.
|
boolean |
isUpgradeRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
onSessionClosed(WebSocketSession session)
A Session has been closed
|
void |
onSessionOpened(WebSocketSession session)
A Session has been opened
|
void |
register(java.lang.Class<?> websocketPojo)
Register a websocket class pojo with the default
WebSocketCreator . |
void |
removeSessionListener(WebSocketSession.Listener listener) |
void |
setCreator(WebSocketCreator creator) |
java.lang.String |
toString() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, doStop, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, 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, wait, wait, wait
isRunning
start, stop
public WebSocketServerFactory()
public WebSocketServerFactory(javax.servlet.ServletContext context)
public WebSocketServerFactory(javax.servlet.ServletContext context, ByteBufferPool bufferPool)
public WebSocketServerFactory(javax.servlet.ServletContext context, WebSocketPolicy policy)
WebSocketServletFactory.Loader
context
- the servlet contextpolicy
- the policy to usepublic WebSocketServerFactory(javax.servlet.ServletContext context, WebSocketPolicy policy, ByteBufferPool bufferPool)
protected WebSocketServerFactory(WebSocketPolicy policy, java.util.concurrent.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(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
acceptWebSocket
in interface WebSocketServletFactory
java.io.IOException
public boolean acceptWebSocket(WebSocketCreator creator, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
acceptWebSocket
in interface WebSocketServletFactory
java.io.IOException
public void addSessionFactory(SessionFactory sessionFactory)
public java.lang.Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
createWebSocket
in interface WebSocketCreator
req
- the request detailsresp
- the response detailsprotected void doStart() throws java.lang.Exception
ContainerLifeCycle
doStart
in class ContainerLifeCycle
java.lang.Exception
protected DecoratedObjectFactory findDecorator()
protected java.util.concurrent.Executor findExecutor()
public ByteBufferPool getBufferPool()
WebSocketContainerScope
getBufferPool
in interface WebSocketContainerScope
public WebSocketCreator getCreator()
getCreator
in interface WebSocketServletFactory
public java.util.concurrent.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 java.util.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(javax.servlet.http.HttpServletRequest request, javax.servlet.http.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(java.lang.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
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2019 Webtide. All rights reserved.