Class Rules.request.method
- Enclosing class:
Rules.request
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Constants for directly supported request methods.static final String
Constants for directly supported request methods.static final String
Constants for directly supported request methods.static final Matcher
MatchesDELETE
.static final Matcher
MatchesGET
.static final Matcher
MatchesHEAD
.static final Matcher
MatchesOPTIONS
.static final Matcher
MatchesPOST
.static final Matcher
MatchesPUT
.static final Matcher
MatchesTRACE
.static final String
Constants for directly supported request methods.static final String
Constants for directly supported request methods.static final String
Constants for directly supported request methods.static final String
Constants for directly supported request methods. -
Method Summary
Modifier and TypeMethodDescriptionstatic Action
static Action
constrain
(Collection<String> methods) Constrains a request to the given set of methods.static Matcher
Matches any of a given iterable ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given iterable ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given iterable ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given iterable ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given iterable ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
in
(Collection<String> methods) Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
in
(Collection<String> methods, Rule... rules) Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
in
(Collection<String> methods, Rule[] rules, Rule... otherwise) Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
in
(Collection<String> methods, Iterable<? extends Rule> rules) Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
Matches any of a given set ofHttpServletRequest.getMethod()
.static Matcher
Matches one givenHttpServletRequest.getMethod()
.static Matcher
Matches one givenHttpServletRequest.getMethod()
.static Matcher
Matches one givenHttpServletRequest.getMethod()
.static Matcher
Matches one givenHttpServletRequest.getMethod()
.static Matcher
Matches one givenHttpServletRequest.getMethod()
.static Matcher
MatchesDELETE
.static Matcher
MatchesDELETE
.static Matcher
MatchesDELETE
.static Matcher
MatchesDELETE
.static Matcher
MatchesGET
.static Matcher
MatchesGET
.static Matcher
MatchesGET
.static Matcher
MatchesGET
.static Matcher
MatchesHEAD
.static Matcher
MatchesHEAD
.static Matcher
MatchesHEAD
.static Matcher
MatchesHEAD
.static Matcher
MatchesOPTIONS
.static Matcher
MatchesOPTIONS
.static Matcher
MatchesOPTIONS
.static Matcher
MatchesOPTIONS
.static Matcher
MatchesPOST
.static Matcher
MatchesPOST
.static Matcher
MatchesPOST
.static Matcher
MatchesPOST
.static Matcher
MatchesPUT
.static Matcher
MatchesPUT
.static Matcher
MatchesPUT
.static Matcher
MatchesPUT
.static Matcher
MatchesTRACE
.static Matcher
MatchesTRACE
.static Matcher
MatchesTRACE
.static Matcher
MatchesTRACE
.
-
Field Details
-
DELETE
Constants for directly supported request methods.- See Also:
-
HEAD
Constants for directly supported request methods.- See Also:
-
GET
Constants for directly supported request methods.- See Also:
-
OPTIONS
Constants for directly supported request methods.- See Also:
-
POST
Constants for directly supported request methods.- See Also:
-
PUT
Constants for directly supported request methods.- See Also:
-
TRACE
Constants for directly supported request methods.- See Also:
-
isDELETE
MatchesDELETE
. -
isHEAD
MatchesHEAD
. -
isGET
MatchesGET
. -
isOPTIONS
MatchesOPTIONS
. -
isPOST
MatchesPOST
. -
isPUT
MatchesPUT
. -
isTRACE
MatchesTRACE
.
-
-
Method Details
-
is
Matches one givenHttpServletRequest.getMethod()
. -
is
Matches one givenHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.
-
is
public static Matcher is(String method, Iterable<? extends Rule> rules, Iterable<? extends Rule> otherwise) Matches one givenHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
is
Matches one givenHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.
-
is
Matches one givenHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
in
Matches any of a given iterable ofHttpServletRequest.getMethod()
. -
in
Matches any of a given set ofHttpServletRequest.getMethod()
. -
in
Matches any of a given set ofHttpServletRequest.getMethod()
. -
in
Matches any of a given iterable ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.
-
in
public static Matcher in(Iterable<String> methods, Iterable<? extends Rule> rules, Iterable<? extends Rule> otherwise) Matches any of a given iterable ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
in
Matches any of a given set ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.
-
in
public static Matcher in(Collection<String> methods, Iterable<? extends Rule> rules, Iterable<? extends Rule> otherwise) Matches any of a given set ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
in
Matches any of a given set ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.
-
in
public static Matcher in(String[] methods, Iterable<? extends Rule> rules, Iterable<? extends Rule> otherwise) Matches any of a given set ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
in
Matches any of a given iterable ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.
-
in
Matches any of a given iterable ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
in
Matches any of a given set ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.
-
in
Matches any of a given set ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
in
Matches any of a given set ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.
-
in
Matches any of a given set ofHttpServletRequest.getMethod()
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isDELETE
MatchesDELETE
.- Parameters:
rules
- Invoked only when matched.
-
isDELETE
MatchesDELETE
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isDELETE
MatchesDELETE
.- Parameters:
rules
- Invoked only when matched.
-
isDELETE
MatchesDELETE
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isHEAD
MatchesHEAD
.- Parameters:
rules
- Invoked only when matched.
-
isHEAD
MatchesHEAD
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isHEAD
MatchesHEAD
.- Parameters:
rules
- Invoked only when matched.
-
isHEAD
MatchesHEAD
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isGET
MatchesGET
.- Parameters:
rules
- Invoked only when matched.
-
isGET
MatchesGET
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isGET
MatchesGET
.- Parameters:
rules
- Invoked only when matched.
-
isGET
MatchesGET
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isOPTIONS
MatchesOPTIONS
.- Parameters:
rules
- Invoked only when matched.
-
isOPTIONS
MatchesOPTIONS
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isOPTIONS
MatchesOPTIONS
.- Parameters:
rules
- Invoked only when matched.
-
isOPTIONS
MatchesOPTIONS
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isPOST
MatchesPOST
.- Parameters:
rules
- Invoked only when matched.
-
isPOST
MatchesPOST
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isPOST
MatchesPOST
.- Parameters:
rules
- Invoked only when matched.
-
isPOST
MatchesPOST
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isPUT
MatchesPUT
.- Parameters:
rules
- Invoked only when matched.
-
isPUT
MatchesPUT
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isPUT
MatchesPUT
.- Parameters:
rules
- Invoked only when matched.
-
isPUT
MatchesPUT
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isTRACE
MatchesTRACE
.- Parameters:
rules
- Invoked only when matched.
-
isTRACE
MatchesTRACE
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
isTRACE
MatchesTRACE
.- Parameters:
rules
- Invoked only when matched.
-
isTRACE
MatchesTRACE
.- Parameters:
rules
- Invoked only when matched.otherwise
- Invoked only when not matched.
-
constrain
Constrains a request to the given set of methods. Always includesOPTIONS
.GET
impliesHEAD
.When
OPTIONS
is not in the given set of methods, responds to the request if is theOPTIONS
method and stops rules processing.OPTIONS
requests are passed-on when included in the set of methods. See https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2Responds with
405 Method Not Allowed
if the request is not one of the given methods,OPTIONS
, or an impliedHEAD
. See https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.5.No action is taken when the dispatcher is
DispatcherType.INCLUDE
, due to the servlet specification making the setting of status codes and headers impossible within includes. SeeRequestDispatcher.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
for more details.TODO: Wrap request/response to convert HEAD to GET here when HEAD implied? Redundant with servlet and Spring MVC behavior, but would not hurt and assumes less about the underlying resources?
TODO: Should this only be applied on the
DispatcherType.REQUEST
dispatcher instead of just skippingDispatcherType.REQUEST
? Should this throw an exception instead of silently taking no action on skipped dispatchers?- Returns:
Action.Result.TERMINATE
if has responded toOPTIONS
or with 405 status.Action.Result.CONTINUE
if the request method is one of the given methods.
-
constrain
-