java.lang.Object
com.github.markusbernhardt.proxy.selector.whitelist.HostnameFilter
All Implemented Interfaces:
UriFilter

public class HostnameFilter extends Object implements UriFilter
Tests if a host name of a given URI matches some criteria.
  • Field Details

  • Constructor Details

    • HostnameFilter

      public HostnameFilter(HostnameFilter.Mode mode, String matchTo)
      Constructor
      Parameters:
      mode - the filter mode.
      matchTo - the match criteria.
  • Method Details

    • extractProtocolFilter

      private void extractProtocolFilter()
      Extracts the protocol if one is given to initialize the protocol matcher.
    • accept

      public boolean accept(URI uri)
      accept
      Specified by:
      accept in interface UriFilter
      Parameters:
      uri - the URI to test.
      Returns:
      true if it matches the criteria else false.
      See Also:
    • isProtocolMatching

      private boolean isProtocolMatching(URI uri)
      Applies the protocol filter if available to see if we have a match.
      Parameters:
      uri - to test for a correct protocol.
      Returns:
      true if passed else false.