public class RewritingStringTransformer extends Object implements StringTransformer
StringTransformer
that manages a collection of named
RewriteRule
s, and applies one or more of them whose name matching
ParseContext.getOraclePolicy()
value.
Typically set up for
FastArchivalUrlReplayParseEventHandler.setJsBlockTrans(StringTransformer)
for rewriting embedded JavaScript based on external rewrite rule database.
Caveat: While this may be useful for rewriting other kinds of text, current implementation works only for embedded JavaScript block (it has explicit context check.)
Constructor and Description |
---|
RewritingStringTransformer() |
Modifier and Type | Method and Description |
---|---|
List<RewriteRule> |
getPolicyRules() |
void |
setPolicyRules(List<RewriteRule> policyRules)
Configure a collection of pre-defined
RewriteRule s. |
String |
transform(ReplayParseContext rpContext,
String input)
transforms text with certain rewrite rules.
|
public List<RewriteRule> getPolicyRules()
public void setPolicyRules(List<RewriteRule> policyRules)
RewriteRule
s.policyRules
- public String transform(ReplayParseContext rpContext, String input)
StringTransformer
Refactoring: change input
type to CharSequence
.
transform
in interface StringTransformer
rpContext
- ReplayParseContextinput
- text data to be transformedCopyright © 2005–2015 IIPC. All rights reserved.