public abstract class RestMatcher extends Object
@RestMethod.matchers()
annotation.
Matchers are used to allow multiple Java methods to handle requests assigned to the same URL path pattern, but differing based on some request attribute, such as a specific header value. For example, matchers can be used to provide two different methods for handling requests from two different client versions.
Java methods with matchers associated with them are always attempted before Java methods without matchers. This allows a 'default' method to be defined to handle requests where no matchers match.
When multiple matchers are specified on a method, only one matcher is required to match.
This is opposite from the @RestMethod.guards()
annotation, where all guards are required to match in order to
execute the method.
Instances must provide one of the following public constructors:
Object resource, Method javaMethod
.
Constructor and Description |
---|
RestMatcher() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
matches(RestRequest req)
Returns
|
boolean |
mustMatch()
Returns
|
public RestMatcher()
public abstract boolean matches(RestRequest req)
req
- The servlet request.public boolean mustMatch()
If
Copyright © 2018 Apache. All rights reserved.