All Packages Class Hierarchy This Package Previous Next Index
Class websphinx.Concatenator
java.lang.Object
|
+----websphinx.HTMLTransformer
|
+----websphinx.LinkTransformer
|
+----websphinx.RewritableLinkTransformer
|
+----websphinx.Concatenator
- public class Concatenator
- extends RewritableLinkTransformer
Transformer that concatenates multiple pages
into a single HTML page.
The entire set of pages is preceded by a "prolog"
and followed by an "epilog", which are constant
strings of HTML. Each page is preceded
by a "header" and followed by a "footer". Adjacent pages
are separated by a "divider".
Concatenator performs the following
transformations on pages before appending them together:
- deletes elements that would conflict, including
<HEADf>, <TITLEf>, <BODYf>, <HTMLf>,
<STYLE>, and <FRAMES>.
- deletes <BASEf> or replaces it with a user-specified
<BASEf>
- changes links among the written pages into
in-page references, of the form "#concatenator_N"
- changes links to other pages into absolute references
-
defaultDivider
-
-
defaultEpilog
-
-
defaultFooter
-
-
defaultHeader
-
-
defaultProlog
-
-
Concatenator(String)
- Make a new Concatenator that writes to a file.
-
close()
- Close the concatenation.
-
getDivider()
- Get the divider.
-
getEpilog()
- Get the epilog.
-
getPageCount()
- Get number of pages written to this mirror.
-
getPageFooter()
- Get the footer.
-
getPageHeader()
- Get the header.
-
getProlog()
- Get the prolog.
-
handleElement(Element)
- Process an HTML element for concatenation.
-
main(String[])
-
-
rewrite()
- Rewrite the concatenation.
-
setDivider(String)
- Set the divider.
-
setEpilog(String)
- Set the epilog.
-
setPageFooter(String)
- Set the footer.
-
setPageHeader(String)
- Set the header.
-
setProlog(String)
- Set the prolog.
-
writePage(Page)
- Write a page to the concatenation.
defaultProlog
public static String defaultProlog
defaultHeader
public static String defaultHeader
defaultFooter
public static String defaultFooter
defaultDivider
public static String defaultDivider
defaultEpilog
public static String defaultEpilog
Concatenator
public Concatenator(String filename) throws IOException
- Make a new Concatenator that writes to a file.
- Parameters:
- filename - Filename to write concatenated pages to
- Throws: IOException
- if file cannot be opened
setProlog
public synchronized void setProlog(String prolog)
- Set the prolog.
- Parameters:
- prolog - string of HTML that is emitted at the beginning
of the concatenation. Default value is:
<HTML><HEAD><TITLE>Concatenation</TITLE></HEAD><BODY>\n
getProlog
public String getProlog()
- Get the prolog.
- Returns:
- string of HTML that is emitted at the beginning
of the concatenation.
setPageHeader
public synchronized void setPageHeader(String header)
- Set the header. The header can contain macro codes which
are replaced with attributes of the page about to be written:
- %t
- title of the page
- %u
- URL of page
- %a
- anchor name of the page ("pageN", where N is the page number)
- %p
- page number (starting from 1)
- Parameters:
- header - string of HTML that is emitted before
each page. The default value is:
<TABLE WIDTH="100%"><TR>\n
<TD ALIGN=left><A NAME="%a">%t [%u]</A>\n
<TD ALIGN=right>Page %p</TABLE>\n
getPageHeader
public String getPageHeader()
- Get the header.
- Returns:
- string of HTML that is emitted before
each page.
setPageFooter
public synchronized void setPageFooter(String footer)
- Set the footer. The footer can contain the same
macros as the header (%t, %u, %a, %p); see setPageHeader
for more details.
- Parameters:
- footer - string of HTML that is emitted after
each page.
getPageFooter
public String getPageFooter()
- Get the footer.
- Returns:
- string of HTML that is emitted after
each page.
setDivider
public synchronized void setDivider(String divider)
- Set the divider.
- Parameters:
- divider - string of HTML that is emitted between
each pair of pages.
getDivider
public String getDivider()
- Get the divider.
- Returns:
- string of HTML that is emitted between
each pair of pages.
setEpilog
public synchronized void setEpilog(String epilog)
- Set the epilog.
- Parameters:
- epilog - string of HTML that is emitted after
the entire concatenation.
getEpilog
public String getEpilog()
- Get the epilog.
- Returns:
- string of HTML that is emitted after
the entire concatenation.
getPageCount
public synchronized int getPageCount()
- Get number of pages written to this mirror.
- Returns:
- number of calls to writePage() on this mirror
rewrite
public synchronized void rewrite() throws IOException
- Rewrite the concatenation. Makes sure all the links
among concatenated pages have been fixed up.
- Overrides:
- rewrite in class RewritableLinkTransformer
close
public synchronized void close() throws IOException
- Close the concatenation. Makes sure all the links
among concatenated pages have been fixed up and closes
the file.
- Overrides:
- close in class RewritableLinkTransformer
writePage
public synchronized void writePage(Page page) throws IOException
- Write a page to the concatenation.
- Parameters:
- page - Page to write
- Overrides:
- writePage in class LinkTransformer
handleElement
protected void handleElement(Element elem) throws IOException
- Process an HTML element for concatenation. Deletes
tags that would
conflict with other pages (such as <HEAD>),
changes the URLs in Link elements, and deletes
or remaps the BASE element.
- Parameters:
- elem - HTML element to process
- Overrides:
- handleElement in class LinkTransformer
main
public static void main(String args[]) throws Exception
All Packages Class Hierarchy This Package Previous Next Index