java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.HeaderRule
Direct Known Subclasses:
ForwardedSchemeHeaderRule

public abstract class HeaderRule extends Rule

Abstract rule that matches against request headers.

  • Constructor Details

    • HeaderRule

      public HeaderRule()
  • Method Details

    • getHeaderName

      public String getHeaderName()
    • setHeaderName

      public void setHeaderName(String header)
    • getHeaderValue

      public String getHeaderValue()
    • setHeaderValue

      public void setHeaderValue(String headerValue)
      Parameters:
      headerValue - the header value to match against. If null, then the presence of the header is enough to match
    • matchAndApply

      public Rule.Handler matchAndApply(Rule.Handler input) throws IOException
      Description copied from class: Rule

      Tests whether the given Request should apply, and if so the rule logic is triggered.

      Specified by:
      matchAndApply in class Rule
      Parameters:
      input - the input Request and Handler
      Returns:
      the possibly wrapped Request and Handler, or null if the rule did not match
      Throws:
      IOException - if applying the rule failed
    • apply

      protected abstract Rule.Handler apply(Rule.Handler input, String value) throws IOException

      Invoked after the header matched the Request headers to apply the rule's logic.

      Parameters:
      input - the input Request and Handler
      value - the header value
      Returns:
      the possibly wrapped Request and Handler
      Throws:
      IOException - if applying the rule failed
    • toString

      public String toString()
      Description copied from class: Rule
      Returns the handling and terminating flag values.
      Overrides:
      toString in class Rule