Class RequestFilter


  • public class RequestFilter
    extends java.lang.Object
    Request filter.
    Used to get filtered data from NetworkDataManager. Currently, filtering is restricted to the request's URL.
    • Constructor Summary

      Constructors 
      Constructor Description
      RequestFilter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accepts​(WebRequest request)
      Returns whether or not the this filter accepts the given request.
      java.lang.String getHostPattern()
      Regular expression to match the host of the wanted request
      java.lang.String getPathPattern()
      Path pattern
      int getPort()
      Port number
      java.lang.String getProtocol()
      Request protocol of the wanted request
      java.lang.String getQueryPattern()
      Query Pattern
      java.lang.String getUrlPattern()
      URL Pattern If the URL pattern is set this overrides all other filters.
      void setHostPattern​(java.lang.String regex)
      Regular expression the matches the wanted request's host
      void setPathPattern​(java.lang.String regex)
      Path pattern
      void setPort​(int port)
      Port number of the wanted request
      void setProtocol​(java.lang.String protocol)
      Request protocol (http, https, ...)
      void setQueryPattern​(java.lang.String regex)
      Query pattern
      void setUrlPattern​(java.lang.String regex)
      URL Pattern If the URL pattern is set this overrides all other filters.
      • Methods inherited from class java.lang.Object

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

      • RequestFilter

        public RequestFilter()
    • Method Detail

      • getProtocol

        public java.lang.String getProtocol()
        Request protocol of the wanted request
        Returns:
        request protocol of the wanted request
      • setProtocol

        public void setProtocol​(java.lang.String protocol)
        Request protocol (http, https, ...)
        Parameters:
        protocol - the wanted request's protocol or null to disable protocol filtering
      • getHostPattern

        public java.lang.String getHostPattern()
        Regular expression to match the host of the wanted request
        Returns:
        regular expression to match the host or null if no host filter is set
      • setHostPattern

        public void setHostPattern​(java.lang.String regex)
        Regular expression the matches the wanted request's host
        Parameters:
        regex - regular expression the matches the wanted request's host or null to disable host filtering
      • getPort

        public int getPort()
        Port number
        Returns:
        port number of the wanted request or -1 if no port filter is set
      • setPort

        public void setPort​(int port)
        Port number of the wanted request
        Parameters:
        port - port number of the wanted request or -1 to disable port filtering
      • getPathPattern

        public java.lang.String getPathPattern()
        Path pattern
        Returns:
        regular expression that matches the wanted request's path or null if path filtering is disabled
      • setPathPattern

        public void setPathPattern​(java.lang.String regex)
        Path pattern
        Parameters:
        regex - regular expression that matches the wanted request's path or null to disable path filtering
      • getQueryPattern

        public java.lang.String getQueryPattern()
        Query Pattern
        Returns:
        regular expression that matches the wanted request's query string or null if query filtering is disabled
      • setQueryPattern

        public void setQueryPattern​(java.lang.String regex)
        Query pattern
        Parameters:
        regex - regular expression that matches the wanted request's query string or null if query filtering is disabled
      • getUrlPattern

        public java.lang.String getUrlPattern()
        URL Pattern If the URL pattern is set this overrides all other filters.
        Returns:
        regular expression that matches the wanted request's URL string or null if URL filtering is disabled
      • setUrlPattern

        public void setUrlPattern​(java.lang.String regex)
        URL Pattern If the URL pattern is set this overrides all other filters.
        Parameters:
        regex - regular expression that matches the wanted request's URL string or null to disable URL filtering
      • accepts

        public boolean accepts​(WebRequest request)
        Returns whether or not the this filter accepts the given request.
        Parameters:
        request - the request to be checked
        Returns:
        true if this filter accepts the given request, false otherwise