public interface Rewriter
Modifier and Type | Method and Description |
---|---|
void |
enterConvertTagEvent(String tag,
MutableAttributes attrs)
Rewriter event called back just before tag conversion (rewriter callbacks) begins by the ParserAdaptor.
|
String |
enterConvertTextEvent(String tag,
String text)
Rewriter event called back for text conversion by the ParserAdaptor.
|
boolean |
enterEndTagEvent(String tag)
Rewriter event called back on the leading edge of processing an end tag by the ParserAdaptor.
|
boolean |
enterSimpleTagEvent(String tag,
MutableAttributes attrs)
Rewriter event called back on the leading edge of processing a simple tag by the ParserAdaptor.
|
boolean |
enterStartTagEvent(String tag,
MutableAttributes attrs)
Rewriter event called back on the leading edge of processing a start tag by the ParserAdaptor.
|
boolean |
enterText(char[] values,
int param)
Rewriter event called back when text is found for
Returns false to indicate to the ParserAdaptor to short-circuit processing on this tag.
|
String |
exitEndTagEvent(String tag)
Rewriter event called back on the trailing edge of a end tag by the ParserAdaptor.
|
String |
exitSimpleTagEvent(String tag,
MutableAttributes attrs)
Rewriter event called back on the trailing edge of a simple tag by the ParserAdaptor.
|
String |
exitStartTagEvent(String tag,
MutableAttributes attrs)
Rewriter event called back on the trailing edge of a start tag by the ParserAdaptor.
|
String |
getBaseRelativeUrl(String path)
Gets a new URL relative to Base according to the site / and URL
rewriting rules of java.net.URL
|
String |
getBaseUrl()
Gets the base URL for rewriting.
|
boolean |
getUseProxy()
Gets whether this rewriter require a proxy server.
|
void |
parse(ParserAdaptor adaptor,
Reader reader)
Parses the reader of content receiving call backs for rewriter events.
|
void |
rewrite(ParserAdaptor adaptor,
Reader reader,
Writer writer)
Parses the reader of content receiving call backs for rewriter events.
|
String |
rewriteText(String tag,
String text)
This event is the inteface between the Rewriter and ParserAdaptor for rewriting text.
|
String |
rewriteUrl(String url,
String tag,
String attribute)
This event is the inteface between the Rewriter and ParserAdaptor for rewriting URLs.
|
void |
setBaseUrl(String base)
Sets the base URL for rewriting.
|
void |
setUseProxy(boolean useProxy)
Set whether this rewriter require a proxy server.
|
boolean |
shouldRemoveComments()
Returns true if all comments should be removed.
|
boolean |
shouldRemoveTag(String tag)
Returns true if the tag should be removed, otherwise false.
|
boolean |
shouldStripTag(String tag)
Returns true if the tag should be stripped, otherwise false.
|
void parse(ParserAdaptor adaptor, Reader reader) throws RewriterException
adaptor
- the parser adaptor which handles generating SAX-like events called back on this object.reader
- the input stream over the content to be parsed.RewriteException
- when a parsing error occurs or unexpected content is found.RewriterException
void rewrite(ParserAdaptor adaptor, Reader reader, Writer writer) throws RewriterException
adaptor
- the parser adaptor which handles generating SAX-like events called back on this object.reader
- the input stream over the content to be parsed.writer
- the output stream where content is rewritten to.RewriteException
- when a parsing error occurs or unexpected content is found.RewriterException
String rewriteUrl(String url, String tag, String attribute)
url
- the URL to be rewrittentag
- The tag being processedattribute
- The current attribute being processsedString rewriteText(String tag, String text)
tag
- The tag being processedtext
- The current text being processsedboolean shouldRemoveTag(String tag)
boolean shouldStripTag(String tag)
boolean shouldRemoveComments()
void setBaseUrl(String base)
base
- The base URL for this rewriterString getBaseUrl()
String getBaseRelativeUrl(String path)
boolean getUseProxy()
void setUseProxy(boolean useProxy)
useProxy
- true if it requires a proxyboolean enterSimpleTagEvent(String tag, MutableAttributes attrs)
tag
- The name of the tag being processed.attrs
- The attribute list for the tag.String exitSimpleTagEvent(String tag, MutableAttributes attrs)
tag
- The name of the tag being processed.attrs
- The attribute list for the tag.boolean enterStartTagEvent(String tag, MutableAttributes attrs)
tag
- The name of the tag being processed.attrs
- The attribute list for the tag.String exitStartTagEvent(String tag, MutableAttributes attrs)
tag
- The name of the tag being processed.attrs
- The attribute list for the tag.boolean enterEndTagEvent(String tag)
tag
- The name of the tag being processed.attrs
- The attribute list for the tag.String exitEndTagEvent(String tag)
tag
- The name of the tag being processed.attrs
- The attribute list for the tag.boolean enterText(char[] values, int param)
values
- an array of characters containing the text.param
- void enterConvertTagEvent(String tag, MutableAttributes attrs)
tag
- The name of the tag being processed.attrs
- The attribute list for the tag.Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.