|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.util.http.MapHtmlUrl (view source)
public class MapHtmlUrl
Utility class to systematically rewrite links inside of html pages and/or stylesheets. The "convertHtml()" method finds all URL's in the supplied HTML document, including embedded stylesheets and style attributes, and calls "mapURL" for each URL, allowing the URL to be rewritten. (This is intended to replace the MapPage class someday).
Nested Class Summary | |
---|---|
static interface |
MapHtmlUrl.Map
Every URL calls this to map the string. |
Constructor Summary | |
---|---|
MapHtmlUrl(MapHtmlUrl.Map map,
boolean doStyle)
Create a url mapper with the supplied url rewriter. |
Method Summary | |
---|---|
void |
addTag(String name,
String attr)
Add a tag/attribute pair to be mapped. |
String |
convertCSS(String style)
Rewrite URL's in style sheets. |
String |
convertHtml(String html)
Rewrite all the url's in this document. |
void |
delTag(String name)
Remove a tag for mapping |
MapHtmlUrl.Map |
getMap()
Return our mapper instance |
static Hashtable |
init(Hashtable h)
Create a hashtable containing all the standard tag/attribute pairs in HTML whose values are URL's. |
static void |
main(String[] argv)
test this stuff out, sort of. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapHtmlUrl(MapHtmlUrl.Map map, boolean doStyle)
map
- A class that maps URL's to URL's.style
- There can be URL's inside of inline style
attributes. It's not common, and potentially
expensive to look for them, so you pick.Method Detail |
---|
public void addTag(String name, String attr)
name
- An html tagattr
- The attribute that is a URL.public void delTag(String name)
name
- The html tag that shouldn't be examinedpublic MapHtmlUrl.Map getMap()
public static Hashtable init(Hashtable h)
public String convertHtml(String html)
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 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 |