Class HeaderPatternRule

public class HeaderPatternRule extends PatternRule
Sets the header in the response whenever the rule finds a match.
  • Constructor Details

    • HeaderPatternRule

      public HeaderPatternRule()
    • HeaderPatternRule

      public HeaderPatternRule(@Name("pattern") String pattern, @Name("name") String name, @Name("value") String value)
  • Method Details

    • setName

      public void setName(String name)
      Sets the header name.
      name - name of the header field
    • setValue

      public void setValue(String value)
      Sets the header value. The value can be either a String or int value.
      value - of the header field
    • setAdd

      public void setAdd(boolean add)
      Sets the Add flag.
      add - If true, the header is added to the response, otherwise the header it is set on the response.
    • apply

      public String apply(String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
      Invokes this method when a match found. If the header had already been set, the new value overwrites the previous one. Otherwise, it adds the new header name and value.
      Specified by:
      apply in class PatternRule
      target - field to attempt match
      request - request object
      response - response object
      The target (possible updated)
      IOException - exceptions dealing with operating on request or response objects
      See Also:
    • getName

      public String getName()
      Returns the header name.
      the header name.
    • getValue

      public String getValue()
      Returns the header value.
      the header value.
    • isAdd

      public boolean isAdd()
      Returns the add flag value.
      true if add flag set
    • toString

      public String toString()
      Returns the header contents.
      toString in class PatternRule