Class RequestMappingInfo
java.lang.Object
org.springframework.web.servlet.mvc.method.RequestMappingInfo
- All Implemented Interfaces:
- RequestCondition<RequestMappingInfo>
public final class RequestMappingInfo
extends Object
implements RequestCondition<RequestMappingInfo>
Request mapping information. A composite for the following conditions:
 
- PathPatternsRequestConditionwith parsed- PathPatternsor- PatternsRequestConditionwith String patterns via- PathMatcher
- RequestMethodsRequestCondition
- ParamsRequestCondition
- HeadersRequestCondition
- ConsumesRequestCondition
- ProducesRequestCondition
- RequestCondition(optional, custom request condition)
- Since:
- 3.1
- Author:
- Arjen Poutsma, Rossen Stoyanchev
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceDefines a builder for creating a RequestMappingInfo.static classContainer for configuration options used for request mapping purposes.
- 
Constructor SummaryConstructorsConstructorDescriptionRequestMappingInfo(String name, PatternsRequestCondition patterns, RequestMethodsRequestCondition methods, ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes, ProducesRequestCondition produces, RequestCondition<?> custom) Deprecated.RequestMappingInfo(PatternsRequestCondition patterns, RequestMethodsRequestCondition methods, ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes, ProducesRequestCondition produces, RequestCondition<?> custom) Deprecated.as of 5.3 in favor usingRequestMappingInfo.Builderviapaths(String...).RequestMappingInfo(RequestMappingInfo info, RequestCondition<?> customRequestCondition) Deprecated.since 5.3 in favor of usingaddCustomCondition(RequestCondition).
- 
Method SummaryModifier and TypeMethodDescriptionaddCustomCondition(RequestCondition<?> customCondition) Create a new instance based on the current one, also adding the given custom condition.combine(RequestMappingInfo other) Combine "this" request mapping info (i.e.intcompareTo(RequestMappingInfo other, HttpServletRequest request) Compares "this" info (i.e.boolean<T> RequestCondition<T>Returns eithergetPathPatternsCondition()orgetPatternsCondition()depending on which is not null.Return the "consumes" condition of thisRequestMappingInfo; or instance with 0 consumes expressions (nevernull).Return the "custom" condition of thisRequestMappingInfo, ornull.Return the mapping paths that are not patterns.Return the "headers" condition of thisRequestMappingInfo; or instance with 0 header expressions (nevernull).getMatchingCondition(HttpServletRequest request) Checks if all conditions in this request mapping info match the provided request and returns a potentially new request mapping info with conditions tailored to the current request.Return the HTTP request methods of thisRequestMappingInfo; or instance with 0 request methods (nevernull).getName()Return the name for this mapping, ornull.Return the "parameters" condition of thisRequestMappingInfo; or instance with 0 parameter expressions (nevernull).Return the patterns condition in use when parsed patterns areenabled.Return the patterns condition when String pattern matching viaPathMatcheris in use.Return the patterns for theactivepatterns condition as Strings.Return the "produces" condition of thisRequestMappingInfo; or instance with 0 produces expressions (nevernull).inthashCode()mutate()Return a builder to create a new RequestMappingInfo by modifying this one.static RequestMappingInfo.BuilderCreate a newRequestMappingInfo.Builderwith the given paths.toString()
- 
Constructor Details- 
RequestMappingInfo@Deprecated public RequestMappingInfo(@Nullable String name, @Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods, @Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes, @Nullable ProducesRequestCondition produces, @Nullable RequestCondition<?> custom) Deprecated.as of 5.3 in favor usingRequestMappingInfo.Builderviapaths(String...).Full constructor with a mapping name.
- 
RequestMappingInfo@Deprecated public RequestMappingInfo(@Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods, @Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes, @Nullable ProducesRequestCondition produces, @Nullable RequestCondition<?> custom) Deprecated.as of 5.3 in favor usingRequestMappingInfo.Builderviapaths(String...).Create an instance with the given conditions.
- 
RequestMappingInfo@Deprecated public RequestMappingInfo(RequestMappingInfo info, @Nullable RequestCondition<?> customRequestCondition) Deprecated.since 5.3 in favor of usingaddCustomCondition(RequestCondition).Re-create a RequestMappingInfo with the given custom request condition.
 
- 
- 
Method Details- 
getNameReturn the name for this mapping, ornull.
- 
getPathPatternsConditionReturn the patterns condition in use when parsed patterns areenabled.This is mutually exclusive with getPatternsCondition()such that when one returnsnullthe other one returns an instance.- Since:
- 5.3
- See Also:
 
- 
getPatternsConditionReturn the patterns condition when String pattern matching viaPathMatcheris in use.This is mutually exclusive with getPathPatternsCondition()such that when one returnsnullthe other one returns an instance.
- 
getActivePatternsConditionReturns eithergetPathPatternsCondition()orgetPatternsCondition()depending on which is not null.- Since:
- 5.3
 
- 
getDirectPathsReturn the mapping paths that are not patterns.- Since:
- 5.3
 
- 
getPatternValuesReturn the patterns for theactivepatterns condition as Strings.- Since:
- 5.3
 
- 
getMethodsConditionReturn the HTTP request methods of thisRequestMappingInfo; or instance with 0 request methods (nevernull).
- 
getParamsConditionReturn the "parameters" condition of thisRequestMappingInfo; or instance with 0 parameter expressions (nevernull).
- 
getHeadersConditionReturn the "headers" condition of thisRequestMappingInfo; or instance with 0 header expressions (nevernull).
- 
getConsumesConditionReturn the "consumes" condition of thisRequestMappingInfo; or instance with 0 consumes expressions (nevernull).
- 
getProducesConditionReturn the "produces" condition of thisRequestMappingInfo; or instance with 0 produces expressions (nevernull).
- 
getCustomConditionReturn the "custom" condition of thisRequestMappingInfo, ornull.
- 
addCustomConditionCreate a new instance based on the current one, also adding the given custom condition.- Parameters:
- customCondition- the custom condition to add
- Since:
- 5.3
 
- 
combineCombine "this" request mapping info (i.e. the current instance) with another request mapping info instance.Example: combine type- and method-level request mappings. - Specified by:
- combinein interface- RequestCondition<RequestMappingInfo>
- Parameters:
- other- the condition to combine with.
- Returns:
- a new request mapping info instance; never null
 
- 
getMatchingConditionChecks if all conditions in this request mapping info match the provided request and returns a potentially new request mapping info with conditions tailored to the current request.For example the returned instance may contain the subset of URL patterns that match to the current request, sorted with best matching patterns on top. - Specified by:
- getMatchingConditionin interface- RequestCondition<RequestMappingInfo>
- Returns:
- a new instance in case of a match; or nullotherwise
 
- 
compareToCompares "this" info (i.e. the current instance) with another info in the context of a request.Note: It is assumed both instances have been obtained via getMatchingCondition(HttpServletRequest)to ensure they have conditions with content relevant to current request.- Specified by:
- compareToin interface- RequestCondition<RequestMappingInfo>
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
mutateReturn a builder to create a new RequestMappingInfo by modifying this one.- Returns:
- a builder to create a new, modified instance
- Since:
- 5.3.4
 
- 
pathsCreate a newRequestMappingInfo.Builderwith the given paths.- Parameters:
- paths- the paths to use
- Since:
- 4.2
 
 
- 
RequestMappingInfo.Builderviapaths(String...).