org.apache.cocoon.generation
Class RequestParameterGenerator

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.generation.AbstractGenerator
              extended byorg.apache.cocoon.generation.RequestParameterGenerator
All Implemented Interfaces:
CacheableProcessingComponent, Generator, LogEnabled, Poolable, Recyclable, SitemapModelComponent, XMLProducer

public class RequestParameterGenerator
extends AbstractGenerator
implements CacheableProcessingComponent

The RequestParameterGenerator is a simple generator producing as an output a subset of what the RequestGenerator produces.

This generator limits its output to the production of request parameters, completely ignoring things like headers and configurations. An example:

 <req:request xmlns:req="http://apache.org/cocoon/request/2.0">
   <req:requestParameters>
     <req:parameter name="aParameter">
       <req:value>itsValueitsFirstValueitsSecondValue[...]
   </req:requestParameters>
 </req:request>
 

The benefits of this simplified version of RequestGenerator is that it is cacheable. The cacheability is achieved by crafting a very specific key to be passed to Cocoon, so that the caching pipeline can actually identify the differences in parameters.

NOTE: given the nature of this generator, and the strain it might put onto the cache system, it is strongly suggested to limit its use to internal pipelines only, with a controlled number of parameter and values passed to it.

Author:
Pier Fumagalli

Field Summary
static String PREFIX
          The namespace prefix of this generator.
 
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, resolver, source
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.generation.Generator
ROLE
 
Constructor Summary
RequestParameterGenerator()
          Create a new RequestParameterGenerator instance.
 
Method Summary
 void generate()
          Generate the content and send it down to the pipeline.
 Serializable getKey()
          Generate the unique key.
 SourceValidity getValidity()
          Generate (or return) the SourceValidity instance used to possibly validate cached generations.
 void recycle()
          Recycle this instance by wiping all locally held references.
 
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
setup
 
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.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

PREFIX

public static final String PREFIX

The namespace prefix of this generator.

See Also:
Constant Field Values
Constructor Detail

RequestParameterGenerator

public RequestParameterGenerator()

Create a new RequestParameterGenerator instance.

Method Detail

recycle

public void recycle()

Recycle this instance by wiping all locally held references.

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractGenerator
See Also:
Recyclable.recycle()

getKey

public Serializable getKey()

Generate the unique key.

Specified by:
getKey in interface CacheableProcessingComponent
Returns:
The generated key or null if the component is currently not cacheable.
See Also:
CacheableProcessingComponent.getKey()

getValidity

public SourceValidity getValidity()

Generate (or return) the SourceValidity instance used to possibly validate cached generations.

Specified by:
getValidity in interface CacheableProcessingComponent
Returns:
a non null SourceValidity.
See Also:
CacheableProcessingComponent.getKey()

generate

public void generate()
              throws ProcessingException,
                     SAXException,
                     IOException

Generate the content and send it down to the pipeline.

Specified by:
generate in interface Generator
Throws:
ProcessingException
SAXException
IOException
See Also:
Generator.generate()


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.