Package com.xceptance.xlt.api.engine

# Class RequestFilter

java.lang.Object
com.xceptance.xlt.api.engine.RequestFilter

public class RequestFilter extends 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

  Modifier and Type
  Method
  Description
  `boolean`
  `accepts(WebRequest request)`
  Returns whether or not the this filter accepts the given request.
  `String`
  `getHostPattern()`
  Regular expression to match the host of the wanted request
  `String`
  `getPathPattern()`
  Path pattern
  `int`
  `getPort()`
  Port number
  `String`
  `getProtocol()`
  Request protocol of the wanted request
  `String`
  `getQueryPattern()`
  Query Pattern
  `String`
  `getUrlPattern()`
  URL Pattern If the URL pattern is set this overrides all other filters.
  `void`
  `setHostPattern(String regex)`
  Regular expression the matches the wanted request's host
  `void`
  `setPathPattern(String regex)`
  Path pattern
  `void`
  `setPort(int port)`
  Port number of the wanted request
  `void`
  `setProtocol(String protocol)`
  Request protocol (`http`, `https`, ...)
  `void`
  `setQueryPattern(String regex)`
  Query pattern
  `void`
  `setUrlPattern(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 Details

  - ### RequestFilter

    public RequestFilter()

- ## Method Details

  - ### getProtocol

    public String getProtocol()
    Request protocol of the wanted request
    Returns:
      request protocol of the wanted request

  - ### setProtocol

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

  - ### getHostPattern

    public 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(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 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(String regex)
    Path pattern
    Parameters:
      `regex` - regular expression that matches the wanted request's path or `null` to disable path filtering

  - ### getQueryPattern

    public 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(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 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(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