View Javadoc

    1   package org.mortbay.jetty.handler.rewrite;
    2
    3
    4   import javax.servlet.http.HttpServletRequest;
    5   import javax.servlet.http.HttpServletResponse;
    6
    7   import org.mortbay.jetty.Request;
    8   import org.mortbay.jetty.handler.rewrite.PatternRule;
    9
    10
    11  /**
    12   * Set the scheme for the request
    13   *
    14   * @author Ervin Varga
    15   * @author Athena Yao
    16   */
    17  public class ForwardedSchemeHeaderRule extends HeaderRule {
    18      private String _scheme="https";
    19
    20      /* ------------------------------------------------------------ */
    21      public String getScheme()
    22      {
    23          return _scheme;
    24      }
    25
    26      /* ------------------------------------------------------------ */
    27      /**
    28       * @param scheme the scheme to set on the request. Defaults to "https"
    29       */
    30      public void setScheme(String scheme)
    31      {
    32          _scheme = scheme;
    33      }
    34
    35      /* ------------------------------------------------------------ */
    36      protected String apply(String target, String value, HttpServletRequest request, HttpServletResponse response)
    37      {
    38          ((Request) request).setScheme(_scheme);
    39          return target;
    40      }
    41  }