m.c.m.proxyma.plugins.transformers
Class CharsetInspectorTransformer

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

public class CharsetInspectorTransformer
extends AbstractTransformer

This plugin implements an html Charset inspector.
Its scans the html pages seraching for content-tyle meta tags.
If such tag is found, it will use its value to add a conten-type header to the response.
Note: it only runs if the content-type provided by the remote server does not countain a charset encoding.

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

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

Constructor Summary
CharsetInspectorTransformer(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)
          If the encoding charset is not passed into the content-type header, It scans the HTML page searching for it.
 
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

CharsetInspectorTransformer

public CharsetInspectorTransformer(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
If the encoding charset is not passed into the content-type header, It scans the HTML page searching for it.
If it's found, the charset encoding is properly added to the response headers.

Specified by:
process in interface ResourceHandler
Specified by:
process in class AbstractTransformer
Parameters:
aResource - any ProxymaResource
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.