|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.handler.MapPage (view source)
public class MapPage
Utility class to rewrite links inside of web pages so they appear to come from a different site.
Note: This only works for "http", not "https".
This class is deprecated, use the
MapHtmlUrl
class instead.
Field Summary | |
---|---|
int |
count
|
static boolean |
log
|
Vector |
patternMap
|
String |
prefix
|
Hashtable |
tagMap
Initialized to all tag/attribute pairs whose attribute values are considered for rewriting. |
Hashtable |
urlMap
|
Constructor Summary | |
---|---|
MapPage(String prefix)
Create a site mapper. |
Method Summary | |
---|---|
void |
addMapEntry(String name,
String value)
Add or remove an item to the map table |
void |
addPatternEntry(String pattern,
String replacement)
Add or remove an item to the pattern table |
void |
addTag(String name,
String attribute)
add a tag/attribute pair to the rewrite list. |
void |
clearPatterns()
Clear the pattern map. |
String |
convertCSS(String style)
Rewrite URL's in style sheets. |
String |
convertHtml(String content)
Rewrite all the url's in this document. |
String |
convertString(String fix)
Rewrite a url inside a tag parameter. |
void |
log(String message)
diagnostic output |
static void |
main(String[] argv)
test this stuff out, sort of. |
int |
mapCount()
How many tags have been mapped? |
void |
rewriteStyleAttributes(boolean b)
Look for url's in style attributes. |
void |
setMap(Hashtable map)
Set the map table for cross-linked sites. |
void |
setPrefix(String prefix)
Change the prefix that will replace the leading "/" in a URL. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Hashtable tagMap
public Hashtable urlMap
public Vector patternMap
public String prefix
public static boolean log
public int count
Constructor Detail |
---|
public MapPage(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.Method Detail |
---|
public void setPrefix(String prefix)
public void rewriteStyleAttributes(boolean b)
public void addTag(String name, String attribute)
public void setMap(Hashtable map)
public void addMapEntry(String name, String value)
name
- The prefix of the url to matchvalue
- The prefix to replace it with. If null,
remove the prefixpublic void addPatternEntry(String pattern, 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 String convertHtml(String content)
convertString(java.lang.String)
.
content
- The HTML to be processed.
public String convertCSS(String style)
Look for url(href) in a stylesheet value. "href" may be delimited by (") or ('), and surrounding whitespace is ignored.
public String convertString(String fix)
fix
- The value of the tag to be rewritten (fixed)
public void log(String message)
public static void main(String[] argv) throws IOException
IOException
|
Version Kenai-svn-r24, Generated 08/18/09 Copyright (c) 2001-2009, Sun Microsystems. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |