org.apache.jetspeed.util.rewriter
Class ProxyRewriter

java.lang.Object
  extended byorg.apache.jetspeed.util.rewriter.ProxyRewriter
All Implemented Interfaces:
Rewriter

public class ProxyRewriter
extends java.lang.Object
implements Rewriter

Proxy Rewriter for rewriting HTML content with links back to a proxy host. URLs or as web-application full URLs, not relative. Given a relative URL, such a "/content/images/my.gif" it can be rewritten as either a proxied URL, for example: "http://proxyserver/proxy?pxpath=/content/images/my.gif" or a full path to the URL on the web server: "http://www.webserver.com/content/images/my.gif"

Version:
$Id: ProxyRewriter.java,v 1.3 2004/02/23 03:18:59 jford Exp $
Author:
David Sean Taylor

Field Summary
static java.lang.String DEFAULT_PROXY_PARAM
           
protected static char PATH_SEPARATOR
           
 
Constructor Summary
ProxyRewriter()
           
 
Method Summary
 void convertTagEvent(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attrs)
           
 boolean enterEndTagEvent(javax.swing.text.html.HTML.Tag tag)
           
 boolean enterSimpleTagEvent(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attrs)
           
 boolean enterStartTagEvent(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attrs)
           
 boolean enterText(char[] values, int param)
           
 java.lang.String exitEndTagEvent(javax.swing.text.html.HTML.Tag tag)
           
 java.lang.String exitSimpleTagEvent(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attrs)
           
 java.lang.String exitStartTagEvent(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attrs)
           
protected static boolean findImage(char[] chars, int ix)
           
 java.lang.String generateNewUrl(java.lang.String targetURL, javax.swing.text.html.HTML.Tag tag, javax.swing.text.html.HTML.Attribute attribute)
           
 boolean proxyAllTags()
           
 java.lang.String rewrite(java.io.Reader input, java.lang.String baseURL)
           
 java.lang.String rewrite(java.io.Reader input, java.lang.String proxyRoot, java.lang.String baseURL)
           
static byte[] rewriteScript(java.lang.String script, java.lang.String url, java.lang.String proxyHost, java.lang.String base)
           
static java.lang.String translate(java.lang.String proxyURL, java.lang.String targetURL)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROXY_PARAM

public static final java.lang.String DEFAULT_PROXY_PARAM
See Also:
Constant Field Values

PATH_SEPARATOR

protected static final char PATH_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

ProxyRewriter

public ProxyRewriter()
Method Detail

rewrite

public java.lang.String rewrite(java.io.Reader input,
                                java.lang.String proxyRoot,
                                java.lang.String baseURL)
                         throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

generateNewUrl

public java.lang.String generateNewUrl(java.lang.String targetURL,
                                       javax.swing.text.html.HTML.Tag tag,
                                       javax.swing.text.html.HTML.Attribute attribute)
Specified by:
generateNewUrl in interface Rewriter

proxyAllTags

public boolean proxyAllTags()
Specified by:
proxyAllTags in interface Rewriter

rewrite

public java.lang.String rewrite(java.io.Reader input,
                                java.lang.String baseURL)
                         throws java.net.MalformedURLException
Specified by:
rewrite in interface Rewriter
Throws:
java.net.MalformedURLException

rewriteScript

public static byte[] rewriteScript(java.lang.String script,
                                   java.lang.String url,
                                   java.lang.String proxyHost,
                                   java.lang.String base)
                            throws java.io.IOException
Throws:
java.io.IOException

translate

public static java.lang.String translate(java.lang.String proxyURL,
                                         java.lang.String targetURL)

findImage

protected static boolean findImage(char[] chars,
                                   int ix)

enterSimpleTagEvent

public boolean enterSimpleTagEvent(javax.swing.text.html.HTML.Tag tag,
                                   javax.swing.text.MutableAttributeSet attrs)
Specified by:
enterSimpleTagEvent in interface Rewriter

exitSimpleTagEvent

public java.lang.String exitSimpleTagEvent(javax.swing.text.html.HTML.Tag tag,
                                           javax.swing.text.MutableAttributeSet attrs)
Specified by:
exitSimpleTagEvent in interface Rewriter

enterStartTagEvent

public boolean enterStartTagEvent(javax.swing.text.html.HTML.Tag tag,
                                  javax.swing.text.MutableAttributeSet attrs)
Specified by:
enterStartTagEvent in interface Rewriter

exitStartTagEvent

public java.lang.String exitStartTagEvent(javax.swing.text.html.HTML.Tag tag,
                                          javax.swing.text.MutableAttributeSet attrs)
Specified by:
exitStartTagEvent in interface Rewriter

enterEndTagEvent

public boolean enterEndTagEvent(javax.swing.text.html.HTML.Tag tag)
Specified by:
enterEndTagEvent in interface Rewriter

exitEndTagEvent

public java.lang.String exitEndTagEvent(javax.swing.text.html.HTML.Tag tag)
Specified by:
exitEndTagEvent in interface Rewriter

convertTagEvent

public void convertTagEvent(javax.swing.text.html.HTML.Tag tag,
                            javax.swing.text.MutableAttributeSet attrs)
Specified by:
convertTagEvent in interface Rewriter

enterText

public boolean enterText(char[] values,
                         int param)
Specified by:
enterText in interface Rewriter


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