org.eclipse.jetty.rewrite.handler
类 RewriteRegexRule
java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.RegexRule
org.eclipse.jetty.rewrite.handler.RewriteRegexRule
- 所有已实现的接口:
- Rule.ApplyURI
public class RewriteRegexRule
- extends RegexRule
- implements Rule.ApplyURI
Rewrite the URI by matching with a regular expression.
The replacement string may use $n" to replace the nth capture group.
If the replacement string contains ? character, then it is split into a path
and query string component. The replacement query string may also contain $Q, which
is replaced with the original query string.
The returned target contains only the path.
RewriteRegexRule
public RewriteRegexRule()
setReplacement
public void setReplacement(String replacement)
- Whenever a match is found, it replaces with this value.
- 参数:
replacement - the replacement string.
apply
public String apply(String target,
HttpServletRequest request,
HttpServletResponse response,
Matcher matcher)
throws IOException
- 从类
RegexRule 复制的描述
- Apply this rule to the request/response pair.
Called by
RegexRule.matchAndApply(String, HttpServletRequest, HttpServletResponse) if the regex matches.
- 指定者:
- 类
RegexRule 中的 apply
- 参数:
target - field to attempt matchrequest - request objectresponse - response objectmatcher - The Regex matcher that matched the request (with capture groups available for replacement).
- 返回:
- The target (possible updated).
- 抛出:
IOException - exceptions dealing with operating on request or response objects
applyURI
public void applyURI(Request request,
String oldTarget,
String newTarget)
throws IOException
- 指定者:
- 接口
Rule.ApplyURI 中的 applyURI
- 抛出:
IOException
toString
public String toString()
- Returns the replacement string.
- 覆盖:
- 类
RegexRule 中的 toString
Copyright © 2013. All Rights Reserved.