m.c.m.proxyma.plugins.transformers
Class HtmlUrlRewriteTransformer

java.lang.Object
  extended by m.c.m.proxyma.plugins.transformers.AbstractTransformer
      extended by m.c.m.proxyma.plugins.transformers.HtmlUrlRewriteTransformer
All Implemented Interfaces:
ResourceHandler

public class HtmlUrlRewriteTransformer
extends AbstractTransformer

This plugin implements an URL Rewriter.
It scans the HTML page contained into the response-data searching for any URL.
When it finds an URL relative to any of the proxy folders configured into the current context, it uses the UrlRewriterEngine to modify the URL.
Its purpose is to make pages and link relative only to proxyma URIs in order to fully masquerde the real source of the resources.

NOTE: this software is released under GPL License. See the LICENSE of this distribution for more informations.

Version:
$Id: HtmlUrlRewriteTransformer.java 176 2010-07-03 09:02:14Z marcolinuz $
Author:
Marco Casavecchia Morganti (marcolinuz) [marcolinuz-at-gmail.com]

Constructor Summary
HtmlUrlRewriteTransformer(ProxymaContext context)
          The default constructor for this class
It prepares the context logger and the logger for the access-log.
 
Method Summary
 java.lang.String getHtmlDescription()
          Returns a short description of what the plugin does..
 java.lang.String getName()
          Returns the name of the plugin.
 void process(ProxymaResource aResource)
          It scans the HTML page contained into the response searching for any URL.
 
Methods inherited from class m.c.m.proxyma.plugins.transformers.AbstractTransformer
getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlUrlRewriteTransformer

public HtmlUrlRewriteTransformer(ProxymaContext context)
The default constructor for this class
It prepares the context logger and the logger for the access-log. NOTE: Every plugin must have a constructor that takes a ProxymaContext as parameter.

Method Detail

process

public void process(ProxymaResource aResource)
             throws java.lang.Exception
It scans the HTML page contained into the response searching for any URL.
When it finds an URL relative to the path of the current configured proxy folders, it uses the UrlRewriterEngine to modify the URL.

Specified by:
process in interface ResourceHandler
Specified by:
process in class AbstractTransformer
Parameters:
aResource - any ProxymaResource
Throws:
java.lang.Exception

getName

public java.lang.String getName()
Returns the name of the plugin.

Specified by:
getName in interface ResourceHandler
Specified by:
getName in class AbstractTransformer
Returns:
the name of the plugin.

getHtmlDescription

public java.lang.String getHtmlDescription()
Returns a short description of what the plugin does..
You can use html tags into it.
The result of this method call can be used by any interface to explain for what is the puropse of the plugin.

Specified by:
getHtmlDescription in interface ResourceHandler
Specified by:
getHtmlDescription in class AbstractTransformer
Returns:
a short description of the plugin


Copyright © 2010. All Rights Reserved.