Top Description Inners Fields Constructors Methods
org.springframework.web.reactive.result.method

public abstract Class RequestMappingInfoHandlerMapping

extends AbstractHandlerMethodMapping<RequestMappingInfo>
Class Inheritance
Known Direct Subclasses
org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping
Imports
java.lang.reflect.Method, java.util.ArrayList, .Collections, .Comparator, .LinkedHashSet, .List, .Map, .Set, java.util.stream.Collectors, .Stream, reactor.core.publisher.Mono, org.springframework.http.HttpHeaders, .HttpMethod, .InvalidMediaTypeException, .MediaType, org.springframework.http.server.PathContainer, org.springframework.http.server.reactive.ServerHttpRequest, org.springframework.http.server.reactive.observation.ServerRequestObservationContext, org.springframework.util.Assert, .CollectionUtils, .MultiValueMap, org.springframework.web.bind.annotation.RequestMethod, org.springframework.web.method.HandlerMethod, org.springframework.web.reactive.HandlerMapping, org.springframework.web.reactive.result.condition.NameValueExpression, .ProducesRequestCondition, org.springframework.web.server.MethodNotAllowedException, .NotAcceptableStatusException, .ServerWebExchange, .ServerWebInputException, .UnsatisfiedRequestParameterException, .UnsupportedMediaTypeStatusException, org.springframework.web.util.pattern.PathPattern

Abstract base class for classes for which RequestMappingInfo defines the mapping between a request and a handler method.
Authors
Rossen Stoyanchev, Sam Brannen
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
RequestMappingInfoHandlerMapping.HttpOptionsHandler

Default handler for HTTP OPTIONS.

private static class
RequestMappingInfoHandlerMapping.PartialMatchHelper

Aggregate all partial matches and expose methods checking across them.

Field Summary

Modifier and TypeField and Description
private static final Method

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Set<String>
public Mono<HandlerMethod>
getHandlerInternal(ServerWebExchange
the current exchange
exchange
)

Overrides org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getHandlerInternal.

Look up a handler method for the given request.

protected Comparator<RequestMappingInfo>
getMappingComparator(final ServerWebExchange
the current exchange
exchange
)

Implements abstract org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getMappingComparator.

Provide a Comparator to sort RequestMappingInfos matched to a request.

protected RequestMappingInfo

Returns:

an info in case of a match; or null otherwise.
getMatchingMapping
(RequestMappingInfo
the mapping to get a match for
info
,
ServerWebExchange
the current exchange
exchange
)

Implements abstract org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getMatchingMapping.

Check if the given RequestMappingInfo matches the current request and return a (potentially new) instance with conditions that match the current request -- for example with a subset of URL patterns.

protected void
handleMatch(RequestMappingInfo
the matching mapping
info
,
HandlerMethod
the matching method
handlerMethod
,
ServerWebExchange
the current exchange
exchange
)

Overrides org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleMatch.

Expose URI template variables, matrix variables, and producible media types in the request.

protected HandlerMethod
handleNoMatch(Set<RequestMappingInfo>
all registered mappings
infos
,
ServerWebExchange
the current exchange
exchange
)

Overrides org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleNoMatch.

Iterate all RequestMappingInfos once again, look if any match by URL at least and raise exceptions accordingly.

Inherited from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping:
afterPropertiesSetcreateHandlerMethoddetectHandlerMethodsgetCorsConfigurationgetHandlerMethodsgetMappingForMethodgetMappingRegistryhandlerMethodsInitializedhasCorsConfigurationSourceinitCorsConfigurationinitHandlerMethodsisHandlerlookupHandlerMethodregisterHandlerMethodregisterMappingunregisterMapping

Field Detail

HTTP_OPTIONS_HANDLE_METHODback to summary
private static final Method HTTP_OPTIONS_HANDLE_METHOD

Constructor Detail

RequestMappingInfoHandlerMappingback to summary
public RequestMappingInfoHandlerMapping()

Method Detail

getDirectPathsback to summary
protected Set<String> getDirectPaths(RequestMappingInfo info)

Overrides org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getDirectPaths.

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getDirectPaths.

Return the request mapping paths that are not patterns.

Annotations
@Override
getHandlerInternalback to summary
public Mono<HandlerMethod> getHandlerInternal(ServerWebExchange exchange)

Overrides org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getHandlerInternal.

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getHandlerInternal.

Look up a handler method for the given request.

Parameters
exchange:ServerWebExchange

the current exchange

Returns:Mono<HandlerMethod>

Doc from org.springframework.web.reactive.handler.AbstractHandlerMapping.getHandlerInternal.

Mono for the matching handler, if any

Annotations
@Override
getMappingComparatorback to summary
protected Comparator<RequestMappingInfo> getMappingComparator(final ServerWebExchange exchange)

Implements abstract org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getMappingComparator.

Provide a Comparator to sort RequestMappingInfos matched to a request.

Parameters
exchange:ServerWebExchange

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getMappingComparator.

the current exchange

Returns:Comparator<RequestMappingInfo>

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getMappingComparator.

the comparator (never null)

Annotations
@Override
getMatchingMappingback to summary
protected RequestMappingInfo getMatchingMapping(RequestMappingInfo info, ServerWebExchange exchange)

Implements abstract org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getMatchingMapping.

Check if the given RequestMappingInfo matches the current request and return a (potentially new) instance with conditions that match the current request -- for example with a subset of URL patterns.

Parameters
info:RequestMappingInfo

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getMatchingMapping.

the mapping to get a match for

exchange:ServerWebExchange

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.getMatchingMapping.

the current exchange

Returns:RequestMappingInfo

an info in case of a match; or null otherwise.

Annotations
@Override
handleMatchback to summary
protected void handleMatch(RequestMappingInfo info, HandlerMethod handlerMethod, ServerWebExchange exchange)

Overrides org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleMatch.

Expose URI template variables, matrix variables, and producible media types in the request.

Parameters
info:RequestMappingInfo

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleMatch.

the matching mapping

handlerMethod:HandlerMethod

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleMatch.

the matching method

exchange:ServerWebExchange

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleMatch.

the current exchange

Annotations
@Override
@SuppressWarnings:removal
See Also
HandlerMapping#URI_TEMPLATE_VARIABLES_ATTRIBUTE, HandlerMapping#MATRIX_VARIABLES_ATTRIBUTE, HandlerMapping#PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE
handleNoMatchback to summary
protected HandlerMethod handleNoMatch(Set<RequestMappingInfo> infos, ServerWebExchange exchange) throws Exception

Overrides org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleNoMatch.

Iterate all RequestMappingInfos once again, look if any match by URL at least and raise exceptions accordingly.

Parameters
infos:Set<RequestMappingInfo>

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleNoMatch.

all registered mappings

exchange:ServerWebExchange

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleNoMatch.

the current exchange

Returns:HandlerMethod

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleNoMatch.

an alternative HandlerMethod or null

Annotations
@Override
Exceptions
Exception:

Doc from org.springframework.web.reactive.result.method.AbstractHandlerMethodMapping.handleNoMatch.

provides details that can be translated into an error status code

MethodNotAllowedException:
for matches by URL but not by HTTP method
UnsupportedMediaTypeStatusException:
if there are matches by URL and HTTP method but not by consumable media types
NotAcceptableStatusException:
if there are matches by URL and HTTP method but not by producible media types
ServerWebInputException:
if there are matches by URL and HTTP method but not by query parameter conditions
org.springframework.web.reactive.result.method back to summary

private Class RequestMappingInfoHandlerMapping.HttpOptionsHandler

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping.HttpOptionsHandler

Default handler for HTTP OPTIONS.

Field Summary

Modifier and TypeField and Description
private final HttpHeaders

Constructor Summary

AccessConstructor and Description
public
HttpOptionsHandler(Set<HttpMethod> declaredMethods, Set<MediaType> acceptPatch)

Method Summary

Modifier and TypeMethod and Description
public HttpHeaders
private static Set<HttpMethod>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

headersback to summary
private final HttpHeaders headers

Constructor Detail

HttpOptionsHandlerback to summary
public HttpOptionsHandler(Set<HttpMethod> declaredMethods, Set<MediaType> acceptPatch)

Method Detail

handleback to summary
public HttpHeaders handle()
Annotations
@SuppressWarnings:unused
initAllowedHttpMethodsback to summary
private static Set<HttpMethod> initAllowedHttpMethods(Set<HttpMethod> declaredMethods)
org.springframework.web.reactive.result.method back to summary

private final Class RequestMappingInfoHandlerMapping.PartialMatchHelper

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping.PartialMatchHelper

Aggregate all partial matches and expose methods checking across them.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
RequestMappingInfoHandlerMapping.PartialMatchHelper.PartialMatch

Container for a RequestMappingInfo that matches the URL path at least.

Field Summary

Modifier and TypeField and Description
private final List<RequestMappingInfoHandlerMapping.PartialMatchHelper.PartialMatch>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Set<HttpMethod>
getAllowedMethods()

Return declared HTTP methods.

public Set<MediaType>
getConsumableMediaTypes()

Return declared "consumable" types but only among those that also match the "methods" condition.

public Set<MediaType>
getConsumablePatchMediaTypes()

Return declared "consumable" types but only among those that have PATCH specified, or that have no methods at all.

public List<Set<NameValueExpression<String>>>
getParamConditions()

Return declared "params" conditions but only among those that also match the "methods", "consumes", and "params" conditions.

public Set<MediaType>
getProducibleMediaTypes()

Return declared "producible" types but only among those that also match the "methods" and "consumes" conditions.

public boolean
hasConsumesMismatch()

Any partial matches for "methods" and "consumes"?

public boolean
hasMethodsMismatch()

Any partial matches for "methods"?

public boolean
hasParamsMismatch()

Any partial matches for "methods", "consumes", "produces", and "params"?

public boolean
hasProducesMismatch()

Any partial matches for "methods", "consumes", and "produces"?

public boolean
isEmpty()

Whether there are any partial matches.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

partialMatchesback to summary
private final List<RequestMappingInfoHandlerMapping.PartialMatchHelper.PartialMatch> partialMatches

Constructor Detail

PartialMatchHelperback to summary
pack-priv PartialMatchHelper(Set<RequestMappingInfo> infos, ServerWebExchange exchange)

Method Detail

getAllowedMethodsback to summary
public Set<HttpMethod> getAllowedMethods()

Return declared HTTP methods.

getConsumableMediaTypesback to summary
public Set<MediaType> getConsumableMediaTypes()

Return declared "consumable" types but only among those that also match the "methods" condition.

getConsumablePatchMediaTypesback to summary
public Set<MediaType> getConsumablePatchMediaTypes()

Return declared "consumable" types but only among those that have PATCH specified, or that have no methods at all.

getParamConditionsback to summary
public List<Set<NameValueExpression<String>>> getParamConditions()

Return declared "params" conditions but only among those that also match the "methods", "consumes", and "params" conditions.

getProducibleMediaTypesback to summary
public Set<MediaType> getProducibleMediaTypes()

Return declared "producible" types but only among those that also match the "methods" and "consumes" conditions.

hasConsumesMismatchback to summary
public boolean hasConsumesMismatch()

Any partial matches for "methods" and "consumes"?

hasMethodsMismatchback to summary
public boolean hasMethodsMismatch()

Any partial matches for "methods"?

hasParamsMismatchback to summary
public boolean hasParamsMismatch()

Any partial matches for "methods", "consumes", "produces", and "params"?

hasProducesMismatchback to summary
public boolean hasProducesMismatch()

Any partial matches for "methods", "consumes", and "produces"?

isEmptyback to summary
public boolean isEmpty()

Whether there are any partial matches.

org.springframework.web.reactive.result.method back to summary

private Class RequestMappingInfoHandlerMapping.PartialMatchHelper.PartialMatch

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping.PartialMatchHelper.PartialMatch

Container for a RequestMappingInfo that matches the URL path at least.

Field Summary

Modifier and TypeField and Description
private final boolean
private final RequestMappingInfo
private final boolean
private final boolean
private final boolean

Constructor Summary

AccessConstructor and Description
public
PartialMatch(RequestMappingInfo
the RequestMappingInfo that matches the URL path
info
,
ServerWebExchange
the current exchange
exchange
)

Create a new PartialMatch instance.

Method Summary

Modifier and TypeMethod and Description
public RequestMappingInfo
public boolean
public boolean
public boolean
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

consumesMatchback to summary
private final boolean consumesMatch
infoback to summary
private final RequestMappingInfo info
methodsMatchback to summary
private final boolean methodsMatch
paramsMatchback to summary
private final boolean paramsMatch
producesMatchback to summary
private final boolean producesMatch

Constructor Detail

PartialMatchback to summary
public PartialMatch(RequestMappingInfo info, ServerWebExchange exchange)

Create a new PartialMatch instance.

Parameters
info:RequestMappingInfo

the RequestMappingInfo that matches the URL path

exchange:ServerWebExchange

the current exchange

Method Detail

getInfoback to summary
public RequestMappingInfo getInfo()
hasConsumesMatchback to summary
public boolean hasConsumesMatch()
hasMethodsMatchback to summary
public boolean hasMethodsMatch()
hasParamsMatchback to summary
public boolean hasParamsMatch()
hasProducesMatchback to summary
public boolean hasProducesMatch()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override