m.c.m.proxyma.plugins.transformers
Class JSRewriteTransformer

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

public class JSRewriteTransformer
extends AbstractTransformer

This plugin implements a basic and not complete Javascript Rewriter.
Its scans the html pages and the JS files seraching for javascript links.
If any link is found it will be rewritten it in order to masquerde its real source.

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

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

Field Summary
static java.lang.String SRC
           
 
Constructor Summary
JSRewriteTransformer(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 or the JS file 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
 

Field Detail

SRC

public static final java.lang.String SRC
See Also:
Constant Field Values
Constructor Detail

JSRewriteTransformer

public JSRewriteTransformer(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 or the JS file contained into the response searching for any URL.
When it finds an URL relative to a 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.