Package org.rapidcontext.core.type
Class WebMatcher
java.lang.Object
org.rapidcontext.core.type.WebMatcher
An HTTP web request matcher. The web matcher is connected to a web
service and detect if a request can be processed.
- Version:
- 1.0
-
Field Summary
Modifier and TypeFieldDescriptionprotected Dict
The serialized matcher representation.protected WebService
The parent web service for this matcher. -
Constructor Summary
ModifierConstructorDescriptionprotected
WebMatcher
(WebService service, Dict dict) Creates a new web matcher. -
Method Summary
Modifier and TypeMethodDescriptionboolean
auth()
The user authentication required flag.host()
The web server host name to match.int
Matches the specified request and returns the matching score.method()
The HTTP request method to match.parent()
Returns the parent web service this matcher is connected to.path()
The base request path to match.int
port()
The web server port number to match.int
prio()
Returns the matcher priority.void
Processes a matching request.protocol()
The request protocol to match (i.e.int
score()
Returns the web matcher score.toString()
Returns a string representation of this matcher.
-
Field Details
-
service
The parent web service for this matcher. -
dict
The serialized matcher representation.
-
-
Constructor Details
-
WebMatcher
Creates a new web matcher.- Parameters:
service
- the web service to usedict
- the serialized representation
-
-
Method Details
-
toString
Returns a string representation of this matcher. -
parent
Returns the parent web service this matcher is connected to.- Returns:
- the parent web service
-
method
The HTTP request method to match. Defaults to null, meaning that any request method will match.- Returns:
- the HTTP request method to match
-
protocol
The request protocol to match (i.e. "http" or "https"). Defaults to null, meaning that any protocol will match.- Returns:
- the request protocol to match, or null to match any protocol
-
host
The web server host name to match. Defaults to null, meaning that any host name will match.- Returns:
- the web server host name to match, or null to match any host
-
port
public int port()The web server port number to match. Defaults to zero (0), meaning that any port number will match.- Returns:
- the web server port number, or zero (0) match any port
-
path
The base request path to match. Defaults to an empty string, meaning that any path will match.- Returns:
- the base request path to match, or an empty string to match any request
-
auth
public boolean auth()The user authentication required flag. Defaults to false.- Returns:
- true if user authentication is required, or false if it is optional
-
prio
public int prio()Returns the matcher priority. Defaults to zero (0).- Returns:
- the matcher priority, or zero (0) if not set
-
score
public int score()Returns the web matcher score.- Returns:
- the web matcher score
-
match
Matches the specified request and returns the matching score.- Parameters:
request
- the request to match- Returns:
- the match score, or zero (0) if the request doesn't match
-
process
Processes a matching request. If authentication is required, an authentication request will be sent if a user isn't available.- Parameters:
request
- the request to process
-