org.apache.cocoon.generation
Class ServerPagesGenerator

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.generation.AbstractGenerator
              extended by org.apache.cocoon.generation.ComposerGenerator
                  extended by org.apache.cocoon.generation.ServletGenerator
                      extended by org.apache.cocoon.generation.ServerPagesGenerator
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Composable, Configurable, LogEnabled, CacheableProcessingComponent, Generator, SitemapModelComponent, XMLProducer

public class ServerPagesGenerator
extends ServletGenerator
implements CacheableProcessingComponent, Configurable

This class acts as a proxy to a dynamically loadedGenerator delegating actual SAX event generation.

It has a single configuration item : <autocomplete-documents>true|false<autocomplete-documents> (default is false).

This tells the generator to automatically close all elements that weren't properly closed by the XSP, such as when a return statement is used to prematurely end processing. Activating this feature sensibly increases CPU-usage and should therefore be used only if really needed (it's better to have clean XSP pages that don't break abruptly generation flow).

Version:
$Id: ServerPagesGenerator.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ricardo Rocha, Sylvain Wallez

Nested Class Summary
 class ServerPagesGenerator.CompletionPipe
           
 
Field Summary
static String DEFAULT_MARKUP_LANGUAGE
          The default MarkupLanguage
static String DEFAULT_PROGRAMMING_LANGUAGE
          The default ProgrammingLanguage
protected  AbstractServerPage generator
           
protected  String markupLanguage
          The loaded generator's MarkupLanguage
protected  ProgramGenerator programGenerator
          The sitemap-defined server pages program generator
protected  String programmingLanguage
          The loaded generator's ProgrammingLanguage
 
Fields inherited from class org.apache.cocoon.generation.ServletGenerator
context, request, response
 
Fields inherited from class org.apache.cocoon.generation.ComposerGenerator
manager
 
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, 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
ServerPagesGenerator()
           
 
Method Summary
 void compose(ComponentManager manager)
          Set the global component manager.
 void configure(Configuration config)
           
 void dispose()
          dispose
 void generate()
          Generate XML data.
 Serializable getKey()
          Generate the unique key.
 SourceValidity getValidity()
          Generate the validity object.
 void recycle()
          Recycle the generator by removing references
 void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
          Set the SourceResolver, object model Map, the source and sitemap Parameters used to process the request.
 
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

programGenerator

protected ProgramGenerator programGenerator
The sitemap-defined server pages program generator


generator

protected AbstractServerPage generator

markupLanguage

protected String markupLanguage
The loaded generator's MarkupLanguage


programmingLanguage

protected String programmingLanguage
The loaded generator's ProgrammingLanguage


DEFAULT_MARKUP_LANGUAGE

public static final String DEFAULT_MARKUP_LANGUAGE
The default MarkupLanguage

See Also:
Constant Field Values

DEFAULT_PROGRAMMING_LANGUAGE

public static final String DEFAULT_PROGRAMMING_LANGUAGE
The default ProgrammingLanguage

See Also:
Constant Field Values
Constructor Detail

ServerPagesGenerator

public ServerPagesGenerator()
Method Detail

compose

public void compose(ComponentManager manager)
             throws ComponentException
Set the global component manager. This method sets the sitemap-defined program generator

Specified by:
compose in interface Composable
Overrides:
compose in class ComposerGenerator
Parameters:
manager - The global component manager
Throws:
ComponentException

configure

public void configure(Configuration config)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException

getKey

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

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

getValidity

public SourceValidity getValidity()
Generate the validity object. Before this method can be invoked the generateKey() method must be invoked.

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

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws ProcessingException,
                  SAXException,
                  IOException
Description copied from class: AbstractGenerator
Set the SourceResolver, object model Map, the source and sitemap Parameters used to process the request.

Specified by:
setup in interface SitemapModelComponent
Overrides:
setup in class ServletGenerator
Throws:
ProcessingException
SAXException
IOException

generate

public void generate()
              throws IOException,
                     SAXException,
                     ProcessingException
Generate XML data. This method loads a server pages generator associated with its (file) input source and delegates SAX event generator to it taking care of "closing" any event left open by the loaded generator as a result of its possible "premature" return (a common situation in server pages)

Specified by:
generate in interface Generator
Throws:
IOException - IO Error
SAXException - SAX event generation error
ProcessingException - Error during load/execution

recycle

public void recycle()
Recycle the generator by removing references

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

dispose

public void dispose()
dispose

Specified by:
dispose in interface Disposable
Overrides:
dispose in class ComposerGenerator


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