public final class RequestMappingInfo extends Object implements RequestCondition<RequestMappingInfo>
PathPatternsRequestCondition
with parsed PathPatterns
or
PatternsRequestCondition
with String patterns via PathMatcher
RequestMethodsRequestCondition
ParamsRequestCondition
HeadersRequestCondition
ConsumesRequestCondition
ProducesRequestCondition
RequestCondition
(optional, custom request condition)
Modifier and Type | Class and Description |
---|---|
static interface |
RequestMappingInfo.Builder
Defines a builder for creating a RequestMappingInfo.
|
static class |
RequestMappingInfo.BuilderConfiguration
Container for configuration options used for request mapping purposes.
|
Constructor and Description |
---|
RequestMappingInfo(PatternsRequestCondition patterns,
RequestMethodsRequestCondition methods,
ParamsRequestCondition params,
HeadersRequestCondition headers,
ConsumesRequestCondition consumes,
ProducesRequestCondition produces,
RequestCondition<?> custom)
Deprecated.
as of 5.3 in favor using
RequestMappingInfo.Builder via
paths(String...) . |
RequestMappingInfo(RequestMappingInfo info,
RequestCondition<?> customRequestCondition)
Deprecated.
since 5.3 in favor of using
addCustomCondition(RequestCondition) . |
RequestMappingInfo(String name,
PatternsRequestCondition patterns,
RequestMethodsRequestCondition methods,
ParamsRequestCondition params,
HeadersRequestCondition headers,
ConsumesRequestCondition consumes,
ProducesRequestCondition produces,
RequestCondition<?> custom)
Deprecated.
as of 5.3 in favor using
RequestMappingInfo.Builder via
paths(String...) . |
Modifier and Type | Method and Description |
---|---|
RequestMappingInfo |
addCustomCondition(RequestCondition<?> customCondition)
Create a new instance based on the current one, also adding the given
custom condition.
|
RequestMappingInfo |
combine(RequestMappingInfo other)
Combine "this" request mapping info (i.e.
|
int |
compareTo(RequestMappingInfo other,
HttpServletRequest request)
Compares "this" info (i.e.
|
boolean |
equals(Object other) |
<T> RequestCondition<T> |
getActivePatternsCondition()
Returns either
getPathPatternsCondition() or
getPatternsCondition() depending on which is not null. |
ConsumesRequestCondition |
getConsumesCondition()
Return the "consumes" condition of this
RequestMappingInfo ;
or instance with 0 consumes expressions (never null ). |
RequestCondition<?> |
getCustomCondition()
Return the "custom" condition of this
RequestMappingInfo , or null . |
Set<String> |
getDirectPaths()
Return the mapping paths that are not patterns.
|
HeadersRequestCondition |
getHeadersCondition()
Return the "headers" condition of this
RequestMappingInfo ;
or instance with 0 header expressions (never null ). |
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.
|
RequestMethodsRequestCondition |
getMethodsCondition()
Return the HTTP request methods of this
RequestMappingInfo ;
or instance with 0 request methods (never null ). |
String |
getName()
Return the name for this mapping, or
null . |
ParamsRequestCondition |
getParamsCondition()
Return the "parameters" condition of this
RequestMappingInfo ;
or instance with 0 parameter expressions (never null ). |
PathPatternsRequestCondition |
getPathPatternsCondition()
Return the patterns condition in use when parsed patterns are
enabled . |
PatternsRequestCondition |
getPatternsCondition()
Return the patterns condition when String pattern matching via
PathMatcher is in use. |
Set<String> |
getPatternValues()
Return the patterns for the
active
patterns condition as Strings. |
ProducesRequestCondition |
getProducesCondition()
Return the "produces" condition of this
RequestMappingInfo ;
or instance with 0 produces expressions (never null ). |
int |
hashCode() |
static RequestMappingInfo.Builder |
paths(String... paths)
Create a new
RequestMappingInfo.Builder with the given paths. |
String |
toString() |
@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)
RequestMappingInfo.Builder
via
paths(String...)
.@Deprecated public RequestMappingInfo(@Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods, @Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes, @Nullable ProducesRequestCondition produces, @Nullable RequestCondition<?> custom)
RequestMappingInfo.Builder
via
paths(String...)
.@Deprecated public RequestMappingInfo(RequestMappingInfo info, @Nullable RequestCondition<?> customRequestCondition)
addCustomCondition(RequestCondition)
.@Nullable public PathPatternsRequestCondition getPathPatternsCondition()
enabled
.
This is mutually exclusive with getPatternsCondition()
such
that when one returns null
the other one returns an instance.
getActivePatternsCondition()
@Nullable public PatternsRequestCondition getPatternsCondition()
PathMatcher
is in use.
This is mutually exclusive with getPathPatternsCondition()
such that when one returns null
the other one returns an instance.
public <T> RequestCondition<T> getActivePatternsCondition()
getPathPatternsCondition()
or
getPatternsCondition()
depending on which is not null.public Set<String> getDirectPaths()
public Set<String> getPatternValues()
active
patterns condition as Strings.public RequestMethodsRequestCondition getMethodsCondition()
RequestMappingInfo
;
or instance with 0 request methods (never null
).public ParamsRequestCondition getParamsCondition()
RequestMappingInfo
;
or instance with 0 parameter expressions (never null
).public HeadersRequestCondition getHeadersCondition()
RequestMappingInfo
;
or instance with 0 header expressions (never null
).public ConsumesRequestCondition getConsumesCondition()
RequestMappingInfo
;
or instance with 0 consumes expressions (never null
).public ProducesRequestCondition getProducesCondition()
RequestMappingInfo
;
or instance with 0 produces expressions (never null
).@Nullable public RequestCondition<?> getCustomCondition()
RequestMappingInfo
, or null
.public RequestMappingInfo addCustomCondition(RequestCondition<?> customCondition)
customCondition
- the custom condition to addpublic RequestMappingInfo combine(RequestMappingInfo other)
Example: combine type- and method-level request mappings.
combine
in interface RequestCondition<RequestMappingInfo>
other
- the condition to combine with.null
@Nullable public RequestMappingInfo getMatchingCondition(HttpServletRequest 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.
getMatchingCondition
in interface RequestCondition<RequestMappingInfo>
null
otherwisepublic int compareTo(RequestMappingInfo other, HttpServletRequest request)
Note: It is assumed both instances have been obtained via
getMatchingCondition(HttpServletRequest)
to ensure they have
conditions with content relevant to current request.
compareTo
in interface RequestCondition<RequestMappingInfo>
public static RequestMappingInfo.Builder paths(String... paths)
RequestMappingInfo.Builder
with the given paths.paths
- the paths to use