websphinx
Class RewritableLinkTransformer
java.lang.Object
|
+--websphinx.HTMLTransformer
|
+--websphinx.LinkTransformer
|
+--websphinx.RewritableLinkTransformer
- Direct Known Subclasses:
- Concatenator, RecordTransformer
- public class RewritableLinkTransformer
- extends LinkTransformer
Transformer that remaps URLs in links in such a way
that if the URL mapping changes during (or after) some
HTML has been transformed, the HTML can be fixed up after
the fact. This class is used by Concatenator and Mirror,
since in those operations, the URL mapping function
changes as each page is written to the concatenation or
mirror.
Method Summary |
void |
close()
Close the transformer. |
protected void |
handleLink(Link link)
Handle a Link's transformation. |
void |
rewrite()
Rewrite the file, remapping all the URLs according to their
current values from lookup(). |
Methods inherited from class websphinx.LinkTransformer |
getBase, getEmitBaseElement, handleBase, handleElement, isMapped, lookup, map, map, setBase, setEmitBaseElement, writePage |
Methods inherited from class websphinx.HTMLTransformer |
emit, emit, finalize, flush, getFilePointer, getOutputStream, getOutputWriter, getRandomAccessFile, seek, setOutput, setRandomAccessFile, transformContents, transformElement, write, write |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RewritableLinkTransformer
public RewritableLinkTransformer(java.lang.String filename)
throws java.io.IOException
- Make a RewritableLinkTransformer.
- Parameters:
filename
- Filename to write to
close
public void close()
throws java.io.IOException
- Description copied from class:
HTMLTransformer
- Close the transformer. Flushes all buffered data
to disk by calling flush(). This call may be
time-consuming! Don't use the transformer again after
closing it.
- Overrides:
close
in class HTMLTransformer
handleLink
protected void handleLink(Link link)
throws java.io.IOException
- Description copied from class:
LinkTransformer
- Handle a Link's transformation.
Default implementation replaces the link's URL
with lookup(URL).
- Overrides:
handleLink
in class LinkTransformer
- Following copied from class:
websphinx.LinkTransformer
- Parameters:
link
- Link to transform
rewrite
public void rewrite()
throws java.io.IOException
- Rewrite the file, remapping all the URLs according to their
current values from lookup().