public class MapPage
extends java.lang.Object
Note: This only works for "http", not "https".
Modifier and Type | Field and Description |
---|---|
int |
count |
static boolean |
log |
java.util.Vector |
patternMap |
java.lang.String |
prefix |
java.util.Hashtable |
tagMap
Initialized to all tag/attribute pairs whose attribute values are
considered for rewriting.
|
java.util.Hashtable |
urlMap |
Constructor and Description |
---|
MapPage(java.lang.String prefix)
Create a site mapper.
|
Modifier and Type | Method and Description |
---|---|
void |
addMapEntry(java.lang.String name,
java.lang.String value)
Add or remove an item to the map table
|
void |
addPatternEntry(java.lang.String pattern,
java.lang.String replacement)
Add or remove an item to the pattern table
|
void |
addTag(java.lang.String name,
java.lang.String attribute)
add a tag/attribute pair to the rewrite list.
|
void |
clearPatterns()
Clear the pattern map.
|
java.lang.String |
convertHtml(java.lang.String content)
Rewrite all the url's in this document.
|
java.lang.String |
convertString(java.lang.String fix)
Rewrite a url inside a tag parameter.
|
void |
log(java.lang.String message)
diagnostic output
|
int |
mapCount()
How many tags have been mapped?
|
void |
setMap(java.util.Hashtable map)
Set the map table for cross-linked sites.
|
void |
setPrefix(java.lang.String prefix)
Change the prefix that will replace the leading "/" in a URL.
|
public java.util.Hashtable tagMap
public java.util.Hashtable urlMap
public java.util.Vector patternMap
public java.lang.String prefix
public static boolean log
public int count
public MapPage(java.lang.String prefix)
prefix
- Every link starting with "/" has the leading
slash replaced by prefix
. If prefix is
null, then only fully qualified url's are
considered for rewriting.public void setPrefix(java.lang.String prefix)
public void addTag(java.lang.String name, java.lang.String attribute)
public void setMap(java.util.Hashtable map)
public void addMapEntry(java.lang.String name, java.lang.String value)
name
- The prefix of the url to matchvalue
- The prefix to replace it with. If null,
remove the prefixpublic void addPatternEntry(java.lang.String pattern, java.lang.String replacement)
pattern
- The prefix pattern of the url to match
Full tcl8.0-style regexps are supportedreplacement
- The prefix to replace it with. If null,
remove the prefix. \n's are replaced by the
corrosponding sub-matches in the name
Patterns are stored in a vector, with each pattern taking 3 concecutive elements: the pattern, the replacement rule, and the compiled expression. This way they are searched in order. Sample usage: http://www.([^.]*).com/ /site/\1/ will replace the url: http://www.foo.com/a/b.html with /site/foo/a/b.html
public void clearPatterns()
public int mapCount()
public java.lang.String convertHtml(java.lang.String content)
convertString(java.lang.String)
.content
- The HTML to be processed.public java.lang.String convertString(java.lang.String fix)
fix
- The value of the tag to be rewritten (fixed)public void log(java.lang.String message)