Class WebMatcher

java.lang.Object
org.rapidcontext.core.type.WebMatcher

public class WebMatcher extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    protected Dict
    The serialized matcher representation.
    protected WebService
    The parent web service for this matcher.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    WebMatcher(WebService service, Dict dict)
    Creates a new web matcher.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    The user authentication required flag.
    The web server host name to match.
    int
    match(Request request)
    Matches the specified request and returns the matching score.
    The HTTP request method to match.
    Returns the parent web service this matcher is connected to.
    The base request path to match.
    int
    The web server port number to match.
    int
    Returns the matcher priority.
    void
    process(Request request)
    Processes a matching request.
    The request protocol to match (i.e.
    int
    Returns the web matcher score.
    Returns a string representation of this matcher.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • service

      protected WebService service
      The parent web service for this matcher.
    • dict

      protected Dict dict
      The serialized matcher representation.
  • Constructor Details

    • WebMatcher

      protected WebMatcher(WebService service, Dict dict)
      Creates a new web matcher.
      Parameters:
      service - the web service to use
      dict - the serialized representation
  • Method Details

    • toString

      public String toString()
      Returns a string representation of this matcher.
      Overrides:
      toString in class Object
      Returns:
      the string representation
    • parent

      public WebService parent()
      Returns the parent web service this matcher is connected to.
      Returns:
      the parent web service
    • method

      public String 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

      public String 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

      public String 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

      public String 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

      public int match(Request request)
      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

      public void process(Request request)
      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