| |
|
| java.lang.Object websphinx.HTMLTransformer websphinx.LinkTransformer websphinx.Mirror
Mirror | public class Mirror extends LinkTransformer (Code) | | 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.
|
Constructor Summary | |
public | Mirror(String directory) Make a new Mirror. |
Method Summary | |
public synchronized void | close() Close the mirror. | 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".
default filename. | public synchronized int | getPageCount() Get number of pages written to this mirror. | 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. | public static void | main(String[] args) | public synchronized void | mapDir(URL url, String dir) Map a directory URL (of the form http://host/path/) to
a local directory.
Parameters: url - Directory URL. | public synchronized void | rewrite() Rewrite the mirror to make local links consistent. | public synchronized void | setDefaultFilename(String filename) Set the filename used for directory URLs. | public void | write(Region region) | public void | write(String string) | public synchronized void | writePage(Page page) Write a page to the mirror. |
needRewrite | boolean needRewrite(Code) | | |
Mirror | public Mirror(String directory) throws IOException(Code) | | Make a new Mirror.
Parameters: directory - Root directory (on local diskrelative to which the mirror pages are stored) |
close | public synchronized void close() throws IOException(Code) | | Close the mirror. Makes sure that links point to local versions of
pages wherever possible.
|
getDefaultFilename | public String getDefaultFilename()(Code) | | 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".
default filename. Default is "index.html". |
getPageCount | public synchronized int getPageCount()(Code) | | Get number of pages written to this mirror.
number of calls to writePage() on this mirror |
lookupDir | public String lookupDir(URL base, URL url)(Code) | | 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. Ifnull, the returned pathname is an absolute URL (file:/path/). Parameters: url - remote directory URL to look up. Must end in slash. |
mapDir | public synchronized void mapDir(URL url, String dir) throws MalformedURLException(Code) | | Map a directory URL (of the form http://host/path/) to
a local directory.
Parameters: url - Directory URL. Must end with a slash. Parameters: dir - Local directory relative to which descendents ofurl should be saved. |
rewrite | public synchronized void rewrite() throws IOException(Code) | | Rewrite the mirror to make local links consistent.
|
setDefaultFilename | public synchronized void setDefaultFilename(String filename)(Code) | | 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. |
writePage | public synchronized void writePage(Page page) throws IOException(Code) | | 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 |
|
|
|