Class ReversedProxyHandlerMapping
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.reactive.handler.AbstractHandlerMapping
io.microsphere.spring.webflux.handler.ReversedProxyHandlerMapping
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<io.microsphere.spring.web.event.WebEndpointMappingsReadyEvent>,org.springframework.core.Ordered,org.springframework.web.reactive.HandlerMapping
public class ReversedProxyHandlerMapping
extends org.springframework.web.reactive.handler.AbstractHandlerMapping
implements org.springframework.context.ApplicationListener<io.microsphere.spring.web.event.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.
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:
-
WebEndpointMappingAbstractUrlHandlerMappingAbstractHandlerMethodMappingHandlerMetadataWebEndpointMappingFactoryRequestMappingMetadataWebEndpointMappingFactoryRequestMappingInfoHandlerMapping
-
Field Summary
FieldsFields inherited from class org.springframework.web.reactive.handler.AbstractHandlerMapping
mappingsLoggerFields inherited from interface org.springframework.web.reactive.HandlerMapping
BEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected reactor.core.publisher.Mono<?>getHandlerInternal(io.microsphere.spring.web.metadata.WebEndpointMapping webEndpointMapping) protected reactor.core.publisher.Mono<?>getHandlerInternal(org.springframework.web.server.ServerWebExchange serverWebExchange) voidonApplicationEvent(io.microsphere.spring.web.event.WebEndpointMappingsReadyEvent event) Methods inherited from class org.springframework.web.reactive.handler.AbstractHandlerMapping
formatMappingName, getCorsConfiguration, getCorsProcessor, getHandler, getOrder, getPathPatternParser, hasCorsConfigurationSource, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setOrder, setUseCaseSensitiveMatch, setUseTrailingSlashMatchMethods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 reactor.core.publisher.Mono<?> getHandlerInternal(org.springframework.web.server.ServerWebExchange serverWebExchange) - Specified by:
getHandlerInternalin classorg.springframework.web.reactive.handler.AbstractHandlerMapping
-
getHandlerInternal
@Nullable protected reactor.core.publisher.Mono<?> getHandlerInternal(io.microsphere.spring.web.metadata.WebEndpointMapping webEndpointMapping) -
onApplicationEvent
public void onApplicationEvent(io.microsphere.spring.web.event.WebEndpointMappingsReadyEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<io.microsphere.spring.web.event.WebEndpointMappingsReadyEvent>
-