java.lang.Object
com.aoapps.servlet.firewall.virtualhosts.VirtualHost

public class VirtualHost extends Object
A VirtualHost is matched from one or more PartialURL and contains a list of per-virtual-host rules. These rules are called after global rules for requests that match the domains.
  • Method Details

    • generateCanonicalPartialURL

      public static SinglePartialURL generateCanonicalPartialURL(DomainName domain)
      Generates the default partial URL for the given domain as https://${domain}.

      TODO: Should this be a URL to not allow it to be partial?

    • getDomain

      public DomainName getDomain()
      Gets the unique domain name of this host. A virtual host may have any number of hostnames associated with it via PartialURL, but has a single domain name.

      It is possible for a virtual host to exist without any associated PartialURL. In this case, links to it will use the canonical PartialURL, if present, but the host is not matched and served locally.

    • getCanonicalPartialURL

      public PartialURL getCanonicalPartialURL()
      A virtual host always has a canonical partial URL. This is used to generate URLs to the virtual host when there is no matching environment.

      This canonical partial URL may have null fields, which will be taken from the current request via HttpServletRequestFieldSource.

    • getRules

      public List<Rule> getRules()
      Gets an unmodifiable copy of the rules applied to this virtual host.
    • getRulesIterable

      public Iterable<Rule> getRulesIterable()
      Gets an unmodifiable iterator to the rules.

      Implementation Note:
      Is unmodifiable due to being implemented as CopyOnWriteArrayList.iterator().

    • prepend

      public void prepend(Iterable<? extends Rule> rules)
      Inserts rules into the beginning of this virtual host.
    • prepend

      public void prepend(Rule... rules)
      Inserts rules into the beginning of this virtual host.
    • append

      public void append(Iterable<? extends Rule> rules)
      Inserts rules into the end of this virtual host.
    • append

      public void append(Rule... rules)
      Inserts rules into the end of this virtual host.