org.apache.cocoon.transformation
Class EncodeURLTransformer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.apache.cocoon.transformation.EncodeURLTransformer
All Implemented Interfaces:
Poolable, Recyclable, Component, Configurable, LogEnabled, CacheableProcessingComponent, SitemapModelComponent, Transformer, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler

public class EncodeURLTransformer
extends AbstractTransformer
implements Configurable, CacheableProcessingComponent

Version:
CVS $Id: EncodeURLTransformer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Bernhard Huber

Nested Class Summary
static class EncodeURLTransformer.ElementAttributeMatching
          A helper class for matching element names, and attribute names.
 
Field Summary
static String EXCLUDE_NAME
          Configuration name for specifying excluding patterns, ie exclude-name.
static String EXCLUDE_NAME_DEFAULT
          Configuration default exclude pattern, ie img/@src
static String INCLUDE_NAME
          Configuration name for specifying including patterns, ie include-name.
static String INCLUDE_NAME_DEFAULT
          Configuration default exclude pattern, ie .
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
EncodeURLTransformer()
           
 
Method Summary
protected  void checkForEncoding(Request request)
          check if encoding of URLs is neccessary.
 void configure(Configuration configuration)
          BEGIN SitemapComponent methods
 Serializable getKey()
          Generate the unique key.
 SourceValidity getValidity()
          Generate the validity object.
 void recycle()
          Recycle resources of this transformer
 void setup(SourceResolver resolver, Map objectModel, String source, Parameters parameters)
          Setup the transformer.
 void startElement(String uri, String name, String raw, Attributes attributes)
          Start parsing an element
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

EXCLUDE_NAME

public static final String EXCLUDE_NAME
Configuration name for specifying excluding patterns, ie exclude-name.

See Also:
Constant Field Values

INCLUDE_NAME

public static final String INCLUDE_NAME
Configuration name for specifying including patterns, ie include-name.

See Also:
Constant Field Values

EXCLUDE_NAME_DEFAULT

public static final String EXCLUDE_NAME_DEFAULT
Configuration default exclude pattern, ie img/@src

See Also:
Constant Field Values

INCLUDE_NAME_DEFAULT

public static final String INCLUDE_NAME_DEFAULT
Configuration default exclude pattern, ie .*\/@href|.*\/@action|frame/@src

See Also:
Constant Field Values
Constructor Detail

EncodeURLTransformer

public EncodeURLTransformer()
Method Detail

checkForEncoding

protected void checkForEncoding(Request request)
check if encoding of URLs is neccessary. This is true if session object exists, and session-id was provided from URL, or session is new. The result is stored in some instance variables


setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String source,
                  Parameters parameters)
           throws ProcessingException,
                  SAXException,
                  IOException
Setup the transformer.

Setup include, and exclude patterns from the parameters

Specified by:
setup in interface SitemapModelComponent
Parameters:
resolver - source resolver
objectModel - sitemap objects
parameters - request parameters
Throws:
ProcessingException
SAXException
IOException

configure

public void configure(Configuration configuration)
               throws ConfigurationException
BEGIN SitemapComponent methods

Specified by:
configure in interface Configurable
Parameters:
configuration - Description of Parameter
Throws:
ConfigurationException - Description of Exception

recycle

public void recycle()
Recycle resources of this transformer

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractXMLProducer

getKey

public Serializable getKey()
Generate the unique key. This key must be unique inside the space of this component.

Specified by:
getKey in interface CacheableProcessingComponent
Returns:
The generated key hashes the src

getValidity

public SourceValidity getValidity()
Generate the validity object.

Specified by:
getValidity in interface CacheableProcessingComponent
Returns:
The generated validity object or null if the component is currently not cacheable.

startElement

public void startElement(String uri,
                         String name,
                         String raw,
                         Attributes attributes)
                  throws SAXException
Start parsing an element

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class AbstractXMLPipe
Parameters:
uri - of the element
name - of the element
raw - name of the element
attributes - list
Throws:
SAXException - Description of Exception


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.