public class RewritingStringTransformer extends Object implements StringTransformer
StringTransformer that manages a collection of named
RewriteRules, 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
RewriteRules. |
String |
transform(ReplayParseContext rpContext,
String input)
transforms text with certain rewrite rules.
|
public List<RewriteRule> getPolicyRules()
public void setPolicyRules(List<RewriteRule> policyRules)
RewriteRules.policyRules - public String transform(ReplayParseContext rpContext, String input)
StringTransformerRefactoring: change input type to CharSequence.
transform in interface StringTransformerrpContext - ReplayParseContextinput - text data to be transformedCopyright © 2005–2015 IIPC. All rights reserved.