Class HeaderRegexRule

  • public class HeaderRegexRule
    extends RegexRule
    Rule to add a header based on a Regex match
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.jetty.rewrite.handler.Rule

    • Constructor Summary

      Constructor Description
      HeaderRegexRule​(java.lang.String regex, java.lang.String name, java.lang.String value)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String apply​(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.regex.Matcher matcher)
      Apply this rule to the request/response pair.
      java.lang.String getName()
      Returns the header name.
      java.lang.String getValue()
      Returns the header value.
      boolean isAdd()  
      void setAdd​(boolean add)
      Sets the Add flag.
      void setName​(java.lang.String name)
      Sets the header name.
      void setValue​(java.lang.String value)
      Sets the header value.
      java.lang.String toString()
      Returns the regular expression string.
      • Methods inherited from class java.lang.Object

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

      • HeaderRegexRule

        public HeaderRegexRule()
      • HeaderRegexRule

        public HeaderRegexRule​(@Name("regex")
                               java.lang.String regex,
                               java.lang.String name,
                               java.lang.String value)
    • Method Detail

      • setName

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

        public void setValue​(java.lang.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

        protected java.lang.String apply​(java.lang.String target,
                                         javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response,
                                         java.util.regex.Matcher matcher)
        Description copied from class: RegexRule
        Apply this rule to the request/response pair. Called by RegexRule.matchAndApply(String, HttpServletRequest, HttpServletResponse) if the regex matches.
        Specified by:
        apply in class RegexRule
        target - field to attempt match
        request - request object
        response - response object
        matcher - The Regex matcher that matched the request (with capture groups available for replacement).
        The target (possible updated).
        Throws: - exceptions dealing with operating on request or response objects
      • getName

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

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

        public boolean isAdd()
        the add flag value.
      • toString

        public java.lang.String toString()
        Description copied from class: RegexRule
        Returns the regular expression string.
        toString in class RegexRule
        the header contents.