Class NativeWebSocketConfiguration
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.websocket.server.NativeWebSocketConfiguration
- All Implemented Interfaces:
org.eclipse.jetty.util.component.Container,org.eclipse.jetty.util.component.Destroyable,org.eclipse.jetty.util.component.Dumpable,org.eclipse.jetty.util.component.Dumpable.DumpableContainer,org.eclipse.jetty.util.component.LifeCycle,MappedWebSocketCreator
public class NativeWebSocketConfiguration
extends org.eclipse.jetty.util.component.ContainerLifeCycle
implements MappedWebSocketCreator
Interface for Configuring Jetty Server Native WebSockets
Only applicable if using WebSocketUpgradeFilter
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.ListenerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainerNested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
org.eclipse.jetty.util.component.LifeCycle.Listener -
Field Summary
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPINGFields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY -
Constructor Summary
ConstructorsConstructorDescriptionNativeWebSocketConfiguration(javax.servlet.ServletContext context) NativeWebSocketConfiguration(WebSocketServerFactory webSocketServerFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMapping(String rawspec, Class<?> endpointClass) Manually add a WebSocket mapping.voidaddMapping(String rawspec, WebSocketCreator creator) Add a mapping, of a pathspec to a WebSocketCreator.voidaddMapping(PathSpec pathSpec, Class<?> endpointClass) Manually add a WebSocket mapping.voidaddMapping(PathSpec pathSpec, WebSocketCreator creator) Manually add a WebSocket mapping.voidaddMapping(PathSpec spec, WebSocketCreator creator) Deprecated.voiddoStop()Get WebSocketServerFactory being used.getMapping(String rawspec) /** Returns the creator for the given path spec.Deprecated.usegetMatched(String)instead.getMatched(String target) Get the matchingMatchedResourcefor the provided target.org.eclipse.jetty.websocket.api.WebSocketPolicyUsed to configure the DefaultWebSocketPolicyused by all endpoints that don't redeclare the values.booleanremoveMapping(String rawspec) Removes the mapping based on the given path spec.Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansMethods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelfMethods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Constructor Details
-
NativeWebSocketConfiguration
public NativeWebSocketConfiguration(javax.servlet.ServletContext context) -
NativeWebSocketConfiguration
-
-
Method Details
-
doStop
- Overrides:
doStopin classorg.eclipse.jetty.util.component.ContainerLifeCycle- Throws:
Exception
-
getFactory
Get WebSocketServerFactory being used.- Returns:
- the WebSocketServerFactory being used.
-
getMatched
Get the matchingMatchedResourcefor the provided target.- Parameters:
target- the target path- Returns:
- the matching resource, or null if no match.
-
getMatch
Deprecated.usegetMatched(String)instead.Get the matchingMappedResourcefor the provided target.- Parameters:
target- the target path- Returns:
- the matching resource, or null if no match.
-
getPolicy
public org.eclipse.jetty.websocket.api.WebSocketPolicy getPolicy()Used to configure the DefaultWebSocketPolicyused by all endpoints that don't redeclare the values.- Returns:
- the default policy for all WebSockets
-
addMapping
Manually add a WebSocket mapping.If mapping is added before this configuration is started, then it is persisted through stop/start of this configuration's lifecycle. Otherwise it will be removed when this configuration is stopped.
- Specified by:
addMappingin interfaceMappedWebSocketCreator- Parameters:
pathSpec- the pathspec to respond oncreator- the websocket creator to activate on the provided mapping.
-
addMapping
Deprecated.useaddMapping(PathSpec, WebSocketCreator)instead.Manually add a WebSocket mapping.- Specified by:
addMappingin interfaceMappedWebSocketCreator- Parameters:
spec- the pathspec to respond oncreator- the websocket creator to activate on the provided mapping
-
addMapping
Manually add a WebSocket mapping.- Parameters:
pathSpec- the pathspec to respond onendpointClass- the endpoint class to use for new upgrade requests on the provided pathspec (can be anWebSocketannotated POJO, or implementingWebSocketListener)
-
addMapping
Description copied from interface:MappedWebSocketCreatorAdd a mapping, of a pathspec to a WebSocketCreator.Recognized Path Spec syntaxes
/path/toor/or*.extorservlet|{spec}- Servlet Syntax
^{spec}orregex|{spec}- Regex Syntax
uri-template|{spec}- URI Template (see JSR356 and RFC6570 level 1)
- Specified by:
addMappingin interfaceMappedWebSocketCreator- Parameters:
rawspec- the path spec to use.creator- the websocket creator for this specific mapping
-
getMapping
Description copied from interface:MappedWebSocketCreator/** Returns the creator for the given path spec.- Specified by:
getMappingin interfaceMappedWebSocketCreator- Parameters:
rawspec- the spec to test for (using the same spec syntax as seen inMappedWebSocketCreator.addMapping(String, WebSocketCreator))- Returns:
- the websocket creator if path spec exists, or null
-
removeMapping
Description copied from interface:MappedWebSocketCreatorRemoves the mapping based on the given path spec.- Specified by:
removeMappingin interfaceMappedWebSocketCreator- Parameters:
rawspec- the path spec to remove (using the same spec syntax as seen inMappedWebSocketCreator.addMapping(String, WebSocketCreator))- Returns:
- true if underlying mapping were altered, false otherwise
-
addMapping
Manually add a WebSocket mapping.- Parameters:
rawspec- the pathspec to map to (seeMappedWebSocketCreator.addMapping(String, WebSocketCreator)for syntax details)endpointClass- the endpoint class to use for new upgrade requests on the provided pathspec (can be anWebSocketannotated POJO, or implementingWebSocketListener)
-
addMapping(PathSpec, WebSocketCreator)instead.