All Packages Class Hierarchy This Package Previous Next Index
Class websphinx.Mirror
java.lang.Object
|
+----websphinx.HTMLTransformer
|
+----websphinx.LinkTransformer
|
+----websphinx.Mirror
- public class Mirror
- extends LinkTransformer
Offline mirror of a Web site. Web pages written to
a mirror are stored as files on the local disk in a directory
structure mirroring their URLs.
-
Mirror(String)
- Make a new Mirror.
-
close()
- Close the mirror.
-
getDefaultFilename()
- Get the filename used for directory URLs.
-
getPageCount()
- Get number of pages written to this mirror.
-
lookupDir(URL, URL)
- Lookup the local directory to which a remote directory
URL maps.
-
main(String[])
-
-
mapDir(URL, String)
- Map a directory URL (of the form http://host/path/) to
a local directory.
-
rewrite()
- Rewrite the mirror to make local links consistent.
-
setDefaultFilename(String)
- Set the filename used for directory URLs.
-
write(Region)
- Writes a chunk of HTML through the HTML transformer.
-
write(String)
- Writes a literal string through the HTML transformer
(without parsing it or transforming it).
-
writePage(Page)
- Write a page to the mirror.
Mirror
public Mirror(String directory) throws IOException
- Make a new Mirror.
- Parameters:
- directory - Root directory (on local disk
relative to which the mirror pages are stored)
getDefaultFilename
public String getDefaultFilename()
- Get the filename used for directory URLs.
For example, if the default filename is "index.html",
then the remote URL "http://www.xxx.com/path/" would
map to the local pathname "www.xxx.com/path/index.html".
- Returns:
- default filename. Default is "index.html".
setDefaultFilename
public synchronized void setDefaultFilename(String filename)
- Set the filename used for directory URLs.
For example, if the default filename is "index.html",
then the remote URL "http://www.xxx.com/path/" would
map to the local pathname "www.xxx.com/path/index.html".
- Parameters:
- filename - Default filename.
getPageCount
public synchronized int getPageCount()
- Get number of pages written to this mirror.
- Returns:
- number of calls to writePage() on this mirror
write
public void write(Region region) throws IOException
- Writes a chunk of HTML through the HTML transformer.
- Overrides:
- write in class HTMLTransformer
write
public void write(String string) throws IOException
- Writes a literal string through the HTML transformer
(without parsing it or transforming it).
- Overrides:
- write in class HTMLTransformer
writePage
public synchronized void writePage(Page page) throws IOException
- Write a page to the mirror. Stores the page on the local
disk, fixing up its links to point to the local
copies of any pages already stored to this mirror.
- Parameters:
- page - Page to write
- Overrides:
- writePage in class LinkTransformer
close
public synchronized void close() throws IOException
- Close the mirror. Makes sure that links point to local versions of
pages wherever possible.
- Overrides:
- close in class HTMLTransformer
rewrite
public synchronized void rewrite() throws IOException
- Rewrite the mirror to make local links consistent.
mapDir
public synchronized void mapDir(URL url,
String dir) throws MalformedURLException
- Map a directory URL (of the form http://host/path/) to
a local directory.
- Parameters:
- url - Directory URL. Must end with a slash.
- dir - Local directory relative to which descendents of
url should be saved.
lookupDir
public String lookupDir(URL base,
URL url)
- Lookup the local directory to which a remote directory
URL maps.
- Parameters:
- base - local file URL to use as a base. If non-null,
then the returned pathname is relative to this URL. If
null, the returned pathname is an absolute URL (file:/path/).
- url - remote directory URL to look up. Must end in slash.
main
public static void main(String args[]) throws Exception
All Packages Class Hierarchy This Package Previous Next Index