Class Header

All Implemented Interfaces:
Condition, ConditionBuilder, Parameterized

public abstract class Header extends HttpCondition implements Parameterized
A Condition responsible for asserting on specified values of HttpServletRequest.getHeader(String).
Author:
Lincoln Baxter, III
  • Method Details

    • matches

      public static Header matches(String name, String value)
      Create a Header condition that matches against both header name and values.

      The given name and value patterns may be parameterized:

      Header.matches("Accept-Encoding", "{encoding}")
      Header.matches("Accept-{type}", "{value}")
      ...

      Parameters:
      name - ParameterizedPattern matching the header name.
      value - ParameterizedPattern matching the header value.
    • exists

      public static Header exists(String name)
      Create a Header condition that matches only against the existence of a header with a name matching the given pattern. The header value is ignored.

      The given name pattern may be parameterized:

      Header.exists("Accept-Encoding")
      Header.exists("Accept-{acceptType}")
      Header.exists("{anything}")
      ...

      Parameters:
      name - ParameterizedPattern matching the header name.
    • valueExists

      public static Header valueExists(String value)
      Create a Header condition that matches only against the existence of a header with value matching the given pattern. The header name is ignored.

      The given value pattern may be parameterized:

      Header.valueExists("application/xml")
      Header.valueExists("application/{type}")
      Header.valueExists("{anything}")
      ...

      Parameters:
      value - ParameterizedPattern matching the header value.
    • evaluateHttp

      public boolean evaluateHttp(HttpServletRewrite event, EvaluationContext context)
      Specified by:
      evaluateHttp in class HttpCondition
    • getRequiredParameterNames

      public Set<String> getRequiredParameterNames()
      Specified by:
      getRequiredParameterNames in interface Parameterized
    • setParameterStore

      public void setParameterStore(ParameterStore store)
      Specified by:
      setParameterStore in interface Parameterized