public class URLStringTransformer extends Object implements StringTransformer
input is a URL (strictly speaking, URI), typically from an HTML attribute.
As translation is simply delegated to ReplayParseContext passed to
transform(org.archive.wayback.replay.html.ReplayParseContext, java.lang.String) method, this class is merely a holder
of flags value representing a type of context pointed resource is used.
This is necessary because StringTransformer interface does not allow for communicating
this information to ReplayParseContext.contextualizeUrl(String, String).
It delegates translation to jsTransformer if given string
is javascript:. This is used by FastArchivalUrlRelayParserEventHandler
for rewriting HREF attributes.
Possible Refactoring:
FastArchivalUrlReplayParseEventHandler,
MetaRefreshUrlStringTransformer| Constructor and Description |
|---|
URLStringTransformer()
Default constructor
|
URLStringTransformer(String flags)
Flag-setting constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getFlags() |
StringTransformer |
getJsTransformer() |
void |
setFlags(String flags) |
void |
setJsTransformer(StringTransformer jsTransformer)
transformer for
javascript: URIs. |
String |
transform(ReplayParseContext context,
String url)
transforms text with certain rewrite rules.
|
public URLStringTransformer()
public URLStringTransformer(String flags)
flags - String representing how resource is used
(ex. "im_", "cs_")public String transform(ReplayParseContext context, String url)
StringTransformerRefactoring: change input type to CharSequence.
transform in interface StringTransformercontext - ReplayParseContexturl - text data to be transformedpublic String getFlags()
public void setFlags(String flags)
flags - the flags to setpublic StringTransformer getJsTransformer()
public void setJsTransformer(StringTransformer jsTransformer)
javascript: URIs.
if unspecified (null), javascript:
URI is left unprocessed.
jsTransformer - StringTransformerCopyright © 2005–2015 IIPC. All rights reserved.