Class HostMatcher

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String pathRegex
      A regex that will be ran against the host name.
      protected int port
      The request port.
    • Constructor Summary

      Constructors 
      Constructor Description
      HostMatcher()  
    • Field Detail

      • port

        protected int port
        The request port. -1 is the unset/default number
      • pathRegex

        protected java.lang.String pathRegex
        A regex that will be ran against the host name. If there is a match then the matcher accepts the uri.
    • Constructor Detail

      • HostMatcher

        public HostMatcher()
    • Method Detail

      • matches

        public final boolean matches​(MatchInfo matchInfo)
                              throws java.net.UnknownHostException,
                                     java.net.SocketException,
                                     java.net.MalformedURLException
        Description copied from interface: URIMatcher
        Check if the uri is matching.
        Parameters:
        matchInfo - the matching information to check
        Returns:
        true if the uri is matching or false otherwise
        Throws:
        java.net.UnknownHostException
        java.net.SocketException
        java.net.MalformedURLException
      • tryOverrideValidation

        protected abstract java.util.Optional<java.lang.Boolean> tryOverrideValidation​(MatchInfo matchInfo)
                                                                                throws java.net.UnknownHostException,
                                                                                       java.net.SocketException,
                                                                                       java.net.MalformedURLException
        If the subclass has its own checks or if it has a different validation method this method can return a valid value.
        Parameters:
        matchInfo - the match information to validate.
        Throws:
        java.net.UnknownHostException
        java.net.SocketException
        java.net.MalformedURLException
      • setPort

        public final void setPort​(int port)
      • setPathRegex

        public final void setPathRegex​(java.lang.String pathRegex)
        The regular expression used to verify the path of the uri as is expected. All paths start with /.

        The regular expression used are the ones supported by java: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

        Parameters:
        pathRegex - the regular expression.
      • toString

        public abstract java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object