Class RewritePatternRule

    • Nested Class Summary

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

        Rule.ApplyURI
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String apply​(java.lang.String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Apply the rule to the request
      void applyURI​(Request request, java.lang.String oldURI, java.lang.String newURI)
      This method will add _query to the requests's queryString and also combine it with existing queryStrings in the request.
      void setReplacement​(java.lang.String replacement)
      Whenever a match is found, it replaces with this value.
      java.lang.String toString()
      Returns the replacement string.
      • Methods inherited from class java.lang.Object

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

      • RewritePatternRule

        public RewritePatternRule()
      • RewritePatternRule

        public RewritePatternRule​(@Name("pattern")
                                  java.lang.String pattern,
                                  @Name("replacement")
                                  java.lang.String replacement)
    • Method Detail

      • setReplacement

        public void setReplacement​(java.lang.String replacement)
        Whenever a match is found, it replaces with this value.
        Parameters:
        replacement - the replacement string.
      • apply

        public java.lang.String apply​(java.lang.String target,
                                      javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws java.io.IOException
        Description copied from class: PatternRule
        Apply the rule to the request
        Specified by:
        apply in class PatternRule
        Parameters:
        target - field to attempt match
        request - request object
        response - response object
        Returns:
        The target (possible updated)
        Throws:
        java.io.IOException - exceptions dealing with operating on request or response objects
      • applyURI

        public void applyURI​(Request request,
                             java.lang.String oldURI,
                             java.lang.String newURI)
                      throws java.io.IOException
        This method will add _query to the requests's queryString and also combine it with existing queryStrings in the request. However it won't take care for duplicate. E.g. if request.getQueryString contains a parameter param1 = true and _query will contain param1=false the result will be param1=true&param1=false. To cover this use case some more complex pattern matching is necessary. We can implement this if there's use cases.
        Specified by:
        applyURI in interface Rule.ApplyURI
        Parameters:
        request - the request
        oldURI - the old URI
        newURI - the new URI
        Throws:
        java.io.IOException - if unable to apply the URI
      • toString

        public java.lang.String toString()
        Returns the replacement string.
        Overrides:
        toString in class PatternRule