Class ReversedProxyHandlerMapping
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.handler.AbstractHandlerMapping
io.microsphere.spring.webmvc.handler.ReversedProxyHandlerMapping
- All Implemented Interfaces:
EventListener
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.context.ApplicationContextAware
,org.springframework.context.ApplicationListener<WebEndpointMappingsReadyEvent>
,org.springframework.core.Ordered
,org.springframework.web.context.ServletContextAware
,org.springframework.web.servlet.HandlerMapping
public class ReversedProxyHandlerMapping
extends org.springframework.web.servlet.handler.AbstractHandlerMapping
implements org.springframework.context.ApplicationListener<WebEndpointMappingsReadyEvent>
The performance optimization
HandlerMapping
to process the forwarded request
from the reversed proxy web server, e.g, Spring Cloud Netflix Zuul, Spring Cloud Gateway or others.
The request must have a header named "microsphere_wem_id"
,
which is a string presenting the id of endpoint
, used to
locate the actual endpoint
easily, such as HandlerMethod
,
HandlerFunction
and Controller
.
As a result, ReversedProxyHandlerMapping
has the higher precedence than others, which ensures that it
prioritizes getting the handler
and avoid the duplication
that was executed by the reversed proxy.
As regards the details of endpoint
, it's recommended to read the JavaDoc of
WebEndpointMapping.getEndpoint()
.
For now, ReversedProxyHandlerMapping
only supports to get the handlers from
RequestMappingHandlerMapping
.
- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
-
WebEndpointMapping
AbstractUrlHandlerMapping
AbstractHandlerMethodMapping
HandlerMetadataWebEndpointMappingFactory
RequestMappingMetadataWebEndpointMappingFactory
RequestMappingInfoHandlerMapping
-
Field Summary
FieldsFields inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
mappingsLogger
Fields inherited from interface org.springframework.web.servlet.HandlerMapping
BEST_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_ATTRIBUTE
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.web.servlet.HandlerExecutionChain
getHandlerExecutionChain
(WebEndpointMapping webEndpointMapping, jakarta.servlet.http.HttpServletRequest request) protected Object
getHandlerInternal
(jakarta.servlet.http.HttpServletRequest request) void
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
adaptInterceptor, detectMappedInterceptors, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfiguration, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, hasCorsConfigurationSource, initApplicationContext, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setPatternParser, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatterns
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Field Details
-
DEFAULT_ORDER
public static final int DEFAULT_ORDER- See Also:
-
-
Constructor Details
-
ReversedProxyHandlerMapping
public ReversedProxyHandlerMapping()
-
-
Method Details
-
getHandlerInternal
protected Object getHandlerInternal(jakarta.servlet.http.HttpServletRequest request) throws Exception - Specified by:
getHandlerInternal
in classorg.springframework.web.servlet.handler.AbstractHandlerMapping
- Throws:
Exception
-
getHandlerExecutionChain
@Nullable protected org.springframework.web.servlet.HandlerExecutionChain getHandlerExecutionChain(WebEndpointMapping webEndpointMapping, jakarta.servlet.http.HttpServletRequest request) -
onApplicationEvent
- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener<WebEndpointMappingsReadyEvent>
-