Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.servlet.mvc.condition
Class RequestMethodsRequestCondition

    java.lang.Object
      org.springframework.web.servlet.mvc.condition.AbstractRequestCondition<RequestMethodsRequestCondition>
          org.springframework.web.servlet.mvc.condition.RequestMethodsRequestCondition

All Implemented Interfaces:
  RequestCondition<RequestMethodsRequestCondition>

    public final class RequestMethodsRequestCondition

extends AbstractRequestCondition<RequestMethodsRequestCondition>

A logical disjunction (' || ') request condition that matches a request against a set of `RequestMethod`s.

Since:
  3.1
Author:
  Arjen Poutsma, Rossen Stoyanchev

Constructor Summary
`RequestMethodsRequestCondition(RequestMethod... requestMethods)` Create a new instance with the given request methods.

Method Summary
`RequestMethodsRequestCondition` | `combine(RequestMethodsRequestCondition other)` Returns a new instance with a union of the HTTP request methods from "this" and the "other" instance.
`int` | `compareTo(RequestMethodsRequestCondition other, javax.servlet.http.HttpServletRequest request)` Returns: 0 if the two conditions contain the same number of HTTP request methods.
`protected java.util.Collection<RequestMethod>` | `getContent()` Return the discrete items a request condition is composed of.
`RequestMethodsRequestCondition` | `getMatchingCondition(javax.servlet.http.HttpServletRequest request)` Checks if any of the HTTP request methods match the given request and returns an instance that contains the matching request method only.
`java.util.Set<RequestMethod>` | `getMethods()` Returns all `RequestMethod`s contained in this condition.
`protected java.lang.String` | `getToStringInfix()` The notation to use when printing discrete items of content.

Methods inherited from class org.springframework.web.servlet.mvc.condition.AbstractRequestCondition
`equals, hashCode, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### RequestMethodsRequestCondition

    public RequestMethodsRequestCondition(RequestMethod... requestMethods)

  Create a new instance with the given request methods.

  Parameters:
    `requestMethods` - 0 or more HTTP request methods; if, 0 the condition will match to every request.

Method Detail

### getMethods

    public java.util.Set<RequestMethod> getMethods()

  Returns all `RequestMethod`s contained in this condition.

### getContent

    protected java.util.Collection<RequestMethod> getContent()

  Description copied from class: `AbstractRequestCondition`
  Return the discrete items a request condition is composed of. For example URL patterns, HTTP request methods, param expressions, etc.

  Specified by:
    `getContent` in class `AbstractRequestCondition<RequestMethodsRequestCondition>`
  Returns:
    a collection of objects, never `null`

### getToStringInfix

    protected java.lang.String getToStringInfix()

  Description copied from class: `AbstractRequestCondition`
  The notation to use when printing discrete items of content. For example " || " for URL patterns or " && " for param expressions.

  Specified by:
    `getToStringInfix` in class `AbstractRequestCondition<RequestMethodsRequestCondition>`

### combine

    public RequestMethodsRequestCondition combine(RequestMethodsRequestCondition other)

  Returns a new instance with a union of the HTTP request methods from "this" and the "other" instance.

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

### getMatchingCondition

    public RequestMethodsRequestCondition getMatchingCondition(javax.servlet.http.HttpServletRequest request)

  Checks if any of the HTTP request methods match the given request and returns an instance that contains the matching request method only.

  Parameters:
    `request` - the current request
  Returns:
    the same instance if the condition contains no request method; or a new condition with the matching request method; or `null` if no request methods match.

### compareTo

    public int compareTo(RequestMethodsRequestCondition other,
                         javax.servlet.http.HttpServletRequest request)

  Returns:
  - 0 if the two conditions contain the same number of HTTP request methods.
  - Less than 0 if "this" instance has an HTTP request method but "other" doesn't.
  - Greater than 0 "other" has an HTTP request method but "this" doesn't.

  It is assumed that both instances have been obtained via `getMatchingCondition(HttpServletRequest)` and therefore each instance contains the matching HTTP request method only or is otherwise empty.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD