org.apache.jetspeed.util
Class HTMLRewriter

java.lang.Object
  extended byorg.apache.jetspeed.util.HTMLRewriter

public class HTMLRewriter
extends java.lang.Object

Version:
0.2
Author:
Ingo Rammer (rammer@sycom.at), Santiago Gala, Paul Spencer

Constructor Summary
HTMLRewriter(boolean removeScript, boolean removeStyle, boolean removeNoScript, boolean removeMeta, boolean removeApplet, boolean removeObject, boolean removeHead, boolean removeOnSomething)
          Sets the parameters for the HTMLRewriter
HTMLRewriter(boolean removeScript, boolean removeStyle, boolean removeNoScript, boolean removeMeta, boolean removeApplet, boolean removeObject, boolean removeHead, boolean removeOnSomething, boolean openInNewWindow)
          Sets the parameters for the HTMLRewriter
 
Method Summary
 java.lang.String convertURLs(java.io.Reader HTMLrdr, java.lang.String BaseUrl)
          Does the conversion of the HTML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLRewriter

public HTMLRewriter(boolean removeScript,
                    boolean removeStyle,
                    boolean removeNoScript,
                    boolean removeMeta,
                    boolean removeApplet,
                    boolean removeObject,
                    boolean removeHead,
                    boolean removeOnSomething)
Sets the parameters for the HTMLRewriter

Parameters:
removeScript - Shall SCRIPT-Tags and their content be removed
removeStyle - Shall STYLE-Tags and their content be removed
removeNoScript - Shall NOSCRIPT-Tags and their content be removed
removeMeta - Shall META-Tags be removed
removeApplet - Shall APPLET-Tags and their content be removed
removeObject - Shall OBJECT-Tags and their content be removed
removeHead - Shall HEAD-Tags and their content be removed
removeOnSomething - Shall onClick, onBlur, etc. -Attributes be removed

HTMLRewriter

public HTMLRewriter(boolean removeScript,
                    boolean removeStyle,
                    boolean removeNoScript,
                    boolean removeMeta,
                    boolean removeApplet,
                    boolean removeObject,
                    boolean removeHead,
                    boolean removeOnSomething,
                    boolean openInNewWindow)
Sets the parameters for the HTMLRewriter

Parameters:
removeScript - Shall SCRIPT-Tags and their content be removed
removeStyle - Shall STYLE-Tags and their content be removed
removeNoScript - Shall NOSCRIPT-Tags and their content be removed
removeMeta - Shall META-Tags be removed
removeApplet - Shall APPLET-Tags and their content be removed
removeObject - Shall OBJECT-Tags and their content be removed
removeHead - Shall HEAD-Tags and their content be removed
removeOnSomething - Shall onClick, onBlur, etc. -Attributes be removed
Method Detail

convertURLs

public java.lang.String convertURLs(java.io.Reader HTMLrdr,
                                    java.lang.String BaseUrl)
                             throws java.net.MalformedURLException
Does the conversion of the HTML

Parameters:
HTMLrdr - Reader for HTML to be converted
BaseUrl - URL from which this HTML was taken. We be the base-Url for all URL-rewritings.
Returns:
HTML-String with rewritten URLs and removed (according to constructor-settings) tags
Throws:
java.net.MalformedURLException - If the BaseUrl is not a valid URL or if an URL inside the document could not be converted. Should not happen normally, even in badly formatted HTML.


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.