Spring Framework

org.springframework.web.servlet.mvc.condition
Interface RequestCondition<T>

Type Parameters:
T - The type of objects that this RequestCondition can be combined with compared to.
All Known Implementing Classes:
AbstractRequestCondition, CompositeRequestCondition, ConsumesRequestCondition, HeadersRequestCondition, ParamsRequestCondition, PatternsRequestCondition, ProducesRequestCondition, RequestConditionHolder, RequestMappingInfo, RequestMethodsRequestCondition

public interface RequestCondition<T>

The contract for request conditions.

Request conditions can be combined via combine(Object), matched to a request via getMatchingCondition(HttpServletRequest), and compared to each other via compareTo(Object, HttpServletRequest) to determine which matches a request more closely.

Since:
3.1
Author:
Rossen Stoyanchev, Arjen Poutsma

Method Summary
 T combine(T other)
          Defines the rules for combining this condition (i.e.
 int compareTo(T other, javax.servlet.http.HttpServletRequest request)
          Compares this condition to another condition in the context of a specific request.
 T getMatchingCondition(javax.servlet.http.HttpServletRequest request)
          Checks if this condition matches the given request and returns a potentially new request condition with content tailored to the current request.
 

Method Detail

combine

T combine(T other)
Defines the rules for combining this condition (i.e. the current instance) with another condition. For example combining type- and method-level RequestMapping conditions.

Parameters:
other - the condition to combine with.
Returns:
a request condition instance that is the result of combining the two condition instances.

getMatchingCondition

T getMatchingCondition(javax.servlet.http.HttpServletRequest request)
Checks if this condition matches the given request and returns a potentially new request condition with content tailored to the current request. For example a condition with URL patterns might return a new condition that contains matching patterns sorted with best matching patterns on top.

Returns:
a condition instance in case of a match; or null if there is no match.

compareTo

int compareTo(T other,
              javax.servlet.http.HttpServletRequest request)
Compares this condition to another condition in the context of a specific request. This method assumes both instances have been obtained via getMatchingCondition(HttpServletRequest) to ensure they have content relevant to current request only.


Spring Framework