public class WebSocketHandlerMapping extends SimpleUrlHandlerMapping implements SmartLifecycle
SimpleUrlHandlerMapping with support for more
precise mapping of WebSocket handshake requests to handlers of type
WebSocketHttpRequestHandler. Also delegates Lifecycle
methods to handlers in the SimpleUrlHandlerMapping.getUrlMap() that implement it.mappingsLoggerloggerDEFAULT_PHASEBEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, LOOKUP_PATH, 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 |
|---|---|
protected Object |
getHandlerInternal(HttpServletRequest request)
Look up a handler for the URL path of the given request.
|
protected void |
initServletContext(ServletContext servletContext)
Subclasses may override this for custom initialization based
on the ServletContext that this application object runs in.
|
boolean |
isRunning()
Check whether this component is currently running.
|
void |
setWebSocketUpgradeMatch(boolean match)
When this is set, if the matched handler is
WebSocketHttpRequestHandler, ensure the request is a WebSocket
handshake, i.e. |
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.
|
getUrlMap, initApplicationContext, registerHandlers, setMappings, setUrlMapbuildPathExposingHandler, exposePathWithinMapping, exposeUriTemplateVariables, getHandlerMap, getPathPatternHandlerMap, getRootHandler, lookupHandler, lookupHandler, match, registerHandler, registerHandler, setLazyInitHandlers, setPatternParser, setRootHandler, setUseTrailingSlashMatch, supportsTypeLevelMappings, useTrailingSlashMatch, validateHandleradaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfiguration, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, hasCorsConfigurationSource, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatternsgetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, isContextRequired, setServletContextgetApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPhase, isAutoStartup, stopgetPatternParsergetHandler, usesPathPatternspublic void setWebSocketUpgradeMatch(boolean match)
WebSocketHttpRequestHandler, ensure the request is a WebSocket
handshake, i.e. HTTP GET with the header "Upgrade:websocket",
or otherwise suppress the match and return null allowing another
HandlerMapping to match for the
same URL path.match - whether to enable matching on "Upgrade: websocket"protected 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 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, a given bean's
destroy method will be called without any consideration of stop signals upfront.
Should not throw an exception if the component is not running (not 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 boolean isRunning()
LifecycleIn the case of a container, this will return true only if all
components that apply are currently running.
@Nullable protected Object getHandlerInternal(HttpServletRequest request) throws Exception
AbstractUrlHandlerMappinggetHandlerInternal in class AbstractUrlHandlerMappingrequest - current HTTP requestnull if none foundException - if there is an internal error