public class WebSocketHandlerMapping extends SimpleUrlHandlerMapping implements SmartLifecycle
SimpleUrlHandlerMapping that is also a
SmartLifecycle container and propagates start and stop calls to any
handlers that implement Lifecycle. The handlers are typically expected
to be WebSocketHttpRequestHandler or SockJsHttpRequestHandler.loggerBEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTEHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
WebSocketHandlerMapping() |
| Modifier and Type | Method and Description |
|---|---|
int |
getPhase()
Return the phase value of this object.
|
protected void |
initServletContext(ServletContext servletContext)
Subclasses may override this for custom initialization based
on the ServletContext that this application object runs in.
|
boolean |
isAutoStartup()
Returns
true if this Lifecycle component should get
started automatically by the container at the time that the containing
ApplicationContext gets refreshed. |
boolean |
isRunning()
Check whether this component is currently running.
|
void |
start()
Start this component.
|
void |
stop()
Stop this component, typically in a synchronous fashion, such that the component is
fully stopped upon return of this method.
|
void |
stop(Runnable callback)
Indicates that a Lifecycle component must stop if it is currently running.
|
getUrlMap, initApplicationContext, registerHandlers, setMappings, setUrlMapbuildPathExposingHandler, exposePathWithinMapping, exposeUriTemplateVariables, getHandlerInternal, getHandlerMap, getRootHandler, lookupHandler, match, registerHandler, registerHandler, setLazyInitHandlers, setRootHandler, setUseTrailingSlashMatch, supportsTypeLevelMappings, useTrailingSlashMatch, validateHandleradaptInterceptor, detectMappedInterceptors, extendInterceptors, getAdaptedInterceptors, getCorsConfiguration, getCorsConfigurations, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initInterceptors, setAlwaysUseFullPath, setCorsConfigurations, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelpergetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, isContextRequired, setServletContextgetApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHandlerprotected void initServletContext(ServletContext servletContext)
WebApplicationObjectSupportThe default implementation is empty. Called by
WebApplicationObjectSupport.initApplicationContext(org.springframework.context.ApplicationContext)
as well as WebApplicationObjectSupport.setServletContext(javax.servlet.ServletContext).
initServletContext in class WebApplicationObjectSupportservletContext - the ServletContext that this application object runs in
(never null)public boolean isAutoStartup()
SmartLifecycletrue if this Lifecycle component should get
started automatically by the container at the time that the containing
ApplicationContext gets refreshed.
A value of false indicates that the component is intended to
be started through an explicit Lifecycle.start() call instead, analogous
to a plain Lifecycle implementation.
isAutoStartup in interface SmartLifecycleLifecycle.start(),
Phased.getPhase(),
LifecycleProcessor.onRefresh(),
ConfigurableApplicationContext.refresh()public int getPhase()
Phasedpublic void start()
LifecycleShould not throw an exception if the component is already running.
In the case of a container, this will propagate the start signal to all components that apply.
start in interface LifecycleSmartLifecycle.isAutoStartup()public void stop()
LifecycleSmartLifecycle
and its stop(Runnable) variant when asynchronous stop behavior is necessary.
Note that this stop notification is not guaranteed to come before destruction: On
regular shutdown, Lifecycle beans will first receive a stop notification before
the general destruction callbacks are being propagated; however, on hot refresh during a
context's lifetime or on aborted refresh attempts, only destroy methods will be called.
Should not throw an exception if the component isn't started yet.
In the case of a container, this will propagate the stop signal to all components that apply.
stop in interface LifecycleSmartLifecycle.stop(Runnable),
DisposableBean.destroy()public void stop(Runnable callback)
SmartLifecycleThe provided callback is used by the LifecycleProcessor to support
an ordered, and potentially concurrent, shutdown of all components having a
common shutdown order value. The callback must be executed after
the SmartLifecycle component does indeed stop.
The LifecycleProcessor will call only this variant of the
stop method; i.e. Lifecycle.stop() will not be called for
SmartLifecycle implementations unless explicitly delegated to within
the implementation of this method.
stop in interface SmartLifecycleLifecycle.stop(),
Phased.getPhase()public boolean isRunning()
LifecycleIn the case of a container, this will return true only if all
components that apply are currently running.