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>
ARequestConditionthat consists of the following other conditions:PatternsRequestConditionRequestMethodsRequestConditionParamsRequestConditionHeadersRequestConditionConsumesRequestConditionProducesRequestConditionRequestCondition(optional, custom request condition)
- Since:
- 3.1
- Author:
- Arjen Poutsma, Rossen Stoyanchev
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRequestMappingInfo.BuilderDefines a builder for creating a RequestMappingInfo.static classRequestMappingInfo.BuilderConfigurationContainer for configuration options used for request mapping purposes.
Constructor Summary
Constructors Constructor Description RequestMappingInfo(String name, PatternsRequestCondition patterns, RequestMethodsRequestCondition methods, ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes, ProducesRequestCondition produces, RequestCondition<?> custom)RequestMappingInfo(PatternsRequestCondition patterns, RequestMethodsRequestCondition methods, ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes, ProducesRequestCondition produces, RequestCondition<?> custom)Creates a new instance with the given request conditions.RequestMappingInfo(RequestMappingInfo info, RequestCondition<?> customRequestCondition)Re-create a RequestMappingInfo with the given custom request condition.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RequestMappingInfocombine(RequestMappingInfo other)Combine "this" request mapping info (i.e.intcompareTo(RequestMappingInfo other, HttpServletRequest request)Compares "this" info (i.e.booleanequals(Object other)ConsumesRequestConditiongetConsumesCondition()Return the "consumes" condition of thisRequestMappingInfo; or instance with 0 consumes expressions (nevernull).RequestCondition<?>getCustomCondition()Return the "custom" condition of thisRequestMappingInfo, ornull.HeadersRequestConditiongetHeadersCondition()Return the "headers" condition of thisRequestMappingInfo; or instance with 0 header expressions (nevernull).RequestMappingInfogetMatchingCondition(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.RequestMethodsRequestConditiongetMethodsCondition()Return the HTTP request methods of thisRequestMappingInfo; or instance with 0 request methods (nevernull).StringgetName()Return the name for this mapping, ornull.ParamsRequestConditiongetParamsCondition()Return the "parameters" condition of thisRequestMappingInfo; or instance with 0 parameter expressions (nevernull).PatternsRequestConditiongetPatternsCondition()Return the URL patterns of thisRequestMappingInfo; or instance with 0 patterns (nevernull).ProducesRequestConditiongetProducesCondition()Return the "produces" condition of thisRequestMappingInfo; or instance with 0 produces expressions (nevernull).inthashCode()static RequestMappingInfo.Builderpaths(String... paths)Create a newRequestMappingInfo.Builderwith the given paths.StringtoString()
Constructor Detail
RequestMappingInfo
public RequestMappingInfo(String name, PatternsRequestCondition patterns, RequestMethodsRequestCondition methods, ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes, ProducesRequestCondition produces, RequestCondition<?> custom)
RequestMappingInfo
public RequestMappingInfo(PatternsRequestCondition patterns, RequestMethodsRequestCondition methods, ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes, ProducesRequestCondition produces, RequestCondition<?> custom)
Creates a new instance with the given request conditions.
RequestMappingInfo
public RequestMappingInfo(RequestMappingInfo info, RequestCondition<?> customRequestCondition)
Re-create a RequestMappingInfo with the given custom request condition.
Method Detail
getPatternsCondition
public PatternsRequestCondition getPatternsCondition()
Return the URL patterns of thisRequestMappingInfo; or instance with 0 patterns (nevernull).
getMethodsCondition
public RequestMethodsRequestCondition getMethodsCondition()
Return the HTTP request methods of thisRequestMappingInfo; or instance with 0 request methods (nevernull).
getParamsCondition
public ParamsRequestCondition getParamsCondition()
Return the "parameters" condition of thisRequestMappingInfo; or instance with 0 parameter expressions (nevernull).
getHeadersCondition
public HeadersRequestCondition getHeadersCondition()
Return the "headers" condition of thisRequestMappingInfo; or instance with 0 header expressions (nevernull).
getConsumesCondition
public ConsumesRequestCondition getConsumesCondition()
Return the "consumes" condition of thisRequestMappingInfo; or instance with 0 consumes expressions (nevernull).
getProducesCondition
public ProducesRequestCondition getProducesCondition()
Return the "produces" condition of thisRequestMappingInfo; or instance with 0 produces expressions (nevernull).
getCustomCondition
public RequestCondition<?> getCustomCondition()
Return the "custom" condition of thisRequestMappingInfo, ornull.
combine
public RequestMappingInfo combine(RequestMappingInfo other)
Combine "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 interfaceRequestCondition<RequestMappingInfo>- Parameters:
other- the condition to combine with.- Returns:
- a new request mapping info instance; never
null
getMatchingCondition
public RequestMappingInfo 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.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 interfaceRequestCondition<RequestMappingInfo>- Returns:
- a new instance in case all conditions match; or
nullotherwise
compareTo
public int compareTo(RequestMappingInfo other, HttpServletRequest request)
Compares "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 interfaceRequestCondition<RequestMappingInfo>
paths
public static RequestMappingInfo.Builder paths(String... paths)
Create a newRequestMappingInfo.Builderwith the given paths.- Parameters:
paths- the paths to use- Since:
- 4.2