Top Description Inners Fields Constructors Methods
org.springframework.web.servlet.mvc.method

public final Class RequestMappingInfo

extends Object
implements RequestCondition<RequestMappingInfo>
Class Inheritance
All Implemented Interfaces
org.springframework.web.servlet.mvc.condition.RequestCondition
Imports
java.util.List, .Set, jakarta.servlet.ServletRequest, jakarta.servlet.http.HttpServletRequest, org.springframework.http.HttpMethod, org.springframework.lang.Nullable, org.springframework.util.Assert, .ObjectUtils, .PathMatcher, .StringUtils, org.springframework.web.accept.ContentNegotiationManager, org.springframework.web.bind.annotation.RequestMethod, org.springframework.web.servlet.handler.AbstractHandlerMapping, org.springframework.web.servlet.mvc.condition.ConsumesRequestCondition, .HeadersRequestCondition, .ParamsRequestCondition, .PathPatternsRequestCondition, .PatternsRequestCondition, .ProducesRequestCondition, .RequestCondition, .RequestConditionHolder, .RequestMethodsRequestCondition, org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping, org.springframework.web.util.ServletRequestPathUtils, .UrlPathHelper, org.springframework.web.util.pattern.PathPattern, .PathPatternParser

Request mapping information. A composite for the following conditions:
  1. PathPatternsRequestCondition with parsed PathPatterns or PatternsRequestCondition with String patterns via PathMatcher
  2. RequestMethodsRequestCondition
  3. ParamsRequestCondition
  4. HeadersRequestCondition
  5. ConsumesRequestCondition
  6. ProducesRequestCondition
  7. RequestCondition (optional, custom request condition)
Authors
Arjen Poutsma, Rossen Stoyanchev
Since
3.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
RequestMappingInfo.Builder

Defines a builder for creating a RequestMappingInfo.

public static class
RequestMappingInfo.BuilderConfiguration

Container for configuration options used for request mapping purposes.

private static class
private static class

Field Summary

Modifier and TypeField and Description
private final ConsumesRequestCondition
private final RequestConditionHolder
private static final ConsumesRequestCondition
private static final RequestConditionHolder
private static final HeadersRequestCondition
private static final ParamsRequestCondition
private static final PathPatternsRequestCondition
private static final PatternsRequestCondition
private static final ProducesRequestCondition
private static final RequestMethodsRequestCondition
private final int
private final HeadersRequestCondition
private final RequestMethodsRequestCondition
private final String
private final RequestMappingInfo.BuilderConfiguration
private final ParamsRequestCondition
private final PathPatternsRequestCondition
private final PatternsRequestCondition
private final ProducesRequestCondition

Constructor Summary

AccessConstructor and Description
public
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...).

Full constructor with a mapping name.

public
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...).

Create an instance with the given conditions.

public
RequestMappingInfo(RequestMappingInfo info, RequestCondition<?> customRequestCondition)
Deprecated since 5.3 in favor of using addCustomCondition(RequestCondition).

Re-create a RequestMappingInfo with the given custom request condition.

private
RequestMappingInfo(String name, PathPatternsRequestCondition pathPatternsCondition, PatternsRequestCondition patternsCondition, RequestMethodsRequestCondition methodsCondition, ParamsRequestCondition paramsCondition, HeadersRequestCondition headersCondition, ConsumesRequestCondition consumesCondition, ProducesRequestCondition producesCondition, RequestConditionHolder customCondition, RequestMappingInfo.BuilderConfiguration options)

Method Summary

Modifier and TypeMethod and Description
public RequestMappingInfo
addCustomCondition(RequestCondition<?>
the custom condition to add
customCondition
)

Create a new instance based on the current one, also adding the given custom condition.

private static int
public RequestMappingInfo

Returns:

a new request mapping info instance; never null
combine
(RequestMappingInfo
the condition to combine with.
other
)

Implements org.springframework.web.servlet.mvc.condition.RequestCondition.combine.

Combine "this" request mapping info (i.e. the current instance) with another request mapping info instance.

private String
public int
compareTo(RequestMappingInfo other, HttpServletRequest request)

Implements org.springframework.web.servlet.mvc.condition.RequestCondition.compareTo.

Compares "this" info (i.e. the current instance) with another info in the context of a request.

public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public <T> RequestCondition<T>
getActivePatternsCondition()

Returns either getPathPatternsCondition() or getPatternsCondition() depending on which is not null.

public ConsumesRequestCondition
getConsumesCondition()

Return the "consumes" condition of this RequestMappingInfo; or instance with 0 consumes expressions (never null).

public RequestCondition<?>
getCustomCondition()

Return the "custom" condition of this RequestMappingInfo, or null.

public Set<String>
getDirectPaths()

Return the mapping paths that are not patterns.

public HeadersRequestCondition
getHeadersCondition()

Return the "headers" condition of this RequestMappingInfo; or instance with 0 header expressions (never null).

public RequestMappingInfo

Returns:

a new instance in case of a match; or null otherwise
getMatchingCondition
(HttpServletRequest request)

Implements org.springframework.web.servlet.mvc.condition.RequestCondition.getMatchingCondition.

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.

public RequestMethodsRequestCondition
getMethodsCondition()

Return the HTTP request methods of this RequestMappingInfo; or instance with 0 request methods (never null).

public String
getName()

Return the name for this mapping, or null.

public ParamsRequestCondition
getParamsCondition()

Return the "parameters" condition of this RequestMappingInfo; or instance with 0 parameter expressions (never null).

public PathPatternsRequestCondition
getPathPatternsCondition()

Return the patterns condition in use when parsed patterns are enabled.

public PatternsRequestCondition
getPatternsCondition()

Return the patterns condition when String pattern matching via PathMatcher is in use.

public Set<String>
getPatternValues()

Return the patterns for the active patterns condition as Strings.

public ProducesRequestCondition
getProducesCondition()

Return the "produces" condition of this RequestMappingInfo; or instance with 0 produces expressions (never null).

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
isEmptyMapping()

Whether the request mapping has an empty URL path mapping.

public RequestMappingInfo.Builder

Returns:

a builder to create a new, modified instance
mutate
()

Return a builder to create a new RequestMappingInfo by modifying this one.

public static RequestMappingInfo.Builder
paths(String...
the paths to use
paths
)

Create a new RequestMappingInfo.Builder with the given paths.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait