Top Description Fields Methods
org.springframework.web.reactive

public Interface HandlerMapping

Known Direct Implementers
org.springframework.web.reactive.handler.AbstractHandlerMapping
Imports
reactor.core.publisher.Mono, org.springframework.web.server.ServerWebExchange

Interface to be implemented by objects that define a mapping between requests and handler objects.
Authors
Rossen Stoyanchev, Sebastien Deleuze
Since
5.0

Field Summary

Modifier and TypeField and Description
public static final String
BEST_MATCHING_HANDLER_ATTRIBUTE

Name of the attribute that contains the mapped handler for the best matching pattern.

public static final String
BEST_MATCHING_PATTERN_ATTRIBUTE

Name of the attribute that contains the best matching pattern within the handler mapping.

public static final String
MATRIX_VARIABLES_ATTRIBUTE

Name of the attribute that contains a map with URI variable names and a corresponding MultiValueMap of URI matrix variables for each.

public static final String
PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE

Name of the attribute that contains the path within the handler mapping, in case of a pattern match such as "/static/**" or the full relevant URI otherwise.

public static final String
PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE

Name of the attribute containing the set of producible MediaType's applicable to the mapped handler.

public static final String
URI_TEMPLATE_VARIABLES_ATTRIBUTE

Name of the attribute that contains the URI templates map mapping variable names to values.

Method Summary

Modifier and TypeMethod and Description
public Mono<Object>

Returns:

a Mono that emits one value or none in case the request cannot be resolved to a handler
getHandler
(ServerWebExchange
current server exchange
exchange
)

Return a handler for this request.

Field Detail

BEST_MATCHING_HANDLER_ATTRIBUTEback to summary
public static final String BEST_MATCHING_HANDLER_ATTRIBUTE

Name of the attribute that contains the mapped handler for the best matching pattern.

BEST_MATCHING_PATTERN_ATTRIBUTEback to summary
public static final String BEST_MATCHING_PATTERN_ATTRIBUTE

Name of the attribute that contains the best matching pattern within the handler mapping.

MATRIX_VARIABLES_ATTRIBUTEback to summary
public static final String MATRIX_VARIABLES_ATTRIBUTE

Name of the attribute that contains a map with URI variable names and a corresponding MultiValueMap of URI matrix variables for each.

Note

This attribute is not required to be supported by all HandlerMapping implementations and may also not be present depending on whether the HandlerMapping is configured to keep matrix variable content in the request URI.

PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTEback to summary
public static final String PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE

Name of the attribute that contains the path within the handler mapping, in case of a pattern match such as "/static/**" or the full relevant URI otherwise.

Note

This attribute is not required to be supported by all HandlerMapping implementations. URL-based HandlerMappings will typically support it but handlers should not necessarily expect this request attribute to be present in all scenarios.

PRODUCIBLE_MEDIA_TYPES_ATTRIBUTEback to summary
public static final String PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE

Name of the attribute containing the set of producible MediaType's applicable to the mapped handler.

Note

This attribute is not required to be supported by all HandlerMapping implementations. Handlers should not necessarily expect this request attribute to be present in all scenarios.

URI_TEMPLATE_VARIABLES_ATTRIBUTEback to summary
public static final String URI_TEMPLATE_VARIABLES_ATTRIBUTE

Name of the attribute that contains the URI templates map mapping variable names to values.

Note

This attribute is not required to be supported by all HandlerMapping implementations. URL-based HandlerMappings will typically support it, but handlers should not necessarily expect this request attribute to be present in all scenarios.

Method Detail

getHandlerback to summary
public Mono<Object> getHandler(ServerWebExchange exchange)

Return a handler for this request.

Before returning a handler, an implementing method should check for CORS configuration associated with the handler, apply validation checks based on it, and update the response accordingly. For pre-flight requests, the same should be done based on the handler matching to the expected actual request.

Parameters
exchange:ServerWebExchange

current server exchange

Returns:Mono<Object>

a Mono that emits one value or none in case the request cannot be resolved to a handler