Class HostRoute

  • All Implemented Interfaces:
    Uniform

    public class HostRoute
    extends Route
    Route based on a target VirtualHost. Concurrency note: instances of this class or its subclasses can be invoked by several threads at the same time and therefore must be thread-safe. You should be especially careful when storing state in member variables.
    • Constructor Detail

      • HostRoute

        public HostRoute​(Router router,
                         VirtualHost target)
        Constructor.
        Parameters:
        router - The parent router.
        target - The target virtual host.
    • Method Detail

      • beforeHandle

        protected int beforeHandle​(Request request,
                                   Response response)
        Allows filtering before processing by the next Restlet. Set the base reference.
        Overrides:
        beforeHandle in class Filter
        Parameters:
        request - The request to handle.
        response - The response to update.
        Returns:
        The continuation status.
      • getVirtualHost

        public VirtualHost getVirtualHost()
        Returns the target virtual host.
        Returns:
        The target virtual host.
      • matches

        private boolean matches​(java.lang.String regex,
                                java.lang.String formattedString)
        Matches a formatted string against a regex pattern, in a case insensitive manner.
        Parameters:
        regex - The pattern to use.
        formattedString - The formatted string to match.
        Returns:
        True if the formatted string matched the pattern.
      • score

        public float score​(Request request,
                           Response response)
        Returns the score for a given call (between 0 and 1.0).
        Specified by:
        score in class Route
        Parameters:
        request - The request to score.
        response - The response to score.
        Returns:
        The score for a given call (between 0 and 1.0).
      • setNext

        public void setNext​(VirtualHost next)
        Sets the next virtual host.
        Parameters:
        next - The next virtual host.