Class HostnameFilter

  • All Implemented Interfaces:
    UriFilter

    public class HostnameFilter
    extends java.lang.Object
    implements UriFilter
    Tests if a host name of a given URI matches some criteria.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  HostnameFilter.Mode  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.net.URI uri)
      accept
      private void extractProtocolFilter()
      Extracts the protocol if one is given to initialize the protocol matcher.
      private boolean isProtocolMatching​(java.net.URI uri)
      Applies the protocol filter if available to see if we have a match.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • matchTo

        private java.lang.String matchTo
      • protocolFilter

        private java.lang.String protocolFilter
    • Constructor Detail

      • HostnameFilter

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

      • extractProtocolFilter

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

        public boolean accept​(java.net.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:
        UriFilter.accept(java.net.URI)
      • isProtocolMatching

        private boolean isProtocolMatching​(java.net.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.