com.oroad.stxx.transform
Class CachedXSLTransformer

java.lang.Object
  extended bycom.oroad.stxx.transform.AbstractSAXTransformer
      extended bycom.oroad.stxx.transform.AbstractXSLTransformer
          extended bycom.oroad.stxx.transform.CachedXSLTransformer
All Implemented Interfaces:
Transformer
Direct Known Subclasses:
CachedXFormTransformer

public class CachedXSLTransformer
extends AbstractXSLTransformer
implements Transformer

This class defines the implementation of an XSLT transformer using the Transformation API for XML (TRaX). All templates (compiled XSL templates) are cached upon first use. To reload the cache, reload the application.

This Transformer handles any text-based output.

Author:
Don Brown

Field Summary
protected  boolean allowRenderParameter
          If the type of render can be specified as a request parameter
protected  boolean autoReloadTemplates
          If stylesheets will be automatically reloaded
protected  boolean isPlugin
           
protected  java.lang.String mimeType
          The format type to return
 
Fields inherited from class com.oroad.stxx.transform.AbstractSAXTransformer
allowURLDebug, builder, cache, context, debugXMLPath, expiryTime, log, name, resolveFromTemplatePath, rules, transFactory, writeXMLDebug
 
Fields inherited from interface com.oroad.stxx.transform.Transformer
PROPS_PREFIX
 
Constructor Summary
CachedXSLTransformer()
          Constructor
 
Method Summary
protected  XMLConsumer getXMLConsumer(javax.xml.transform.sax.TransformerHandler handler)
          Creates the XMLConsumer that will be passed to the document builder.
 void init(java.lang.String name, StxxProperties props, javax.servlet.ServletContext context, BuilderRules rules)
          Initializes the transformer
 void transform(ActionTransform trans, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles the transform stage by creating XML from the request and transforming it with one or more XSL files.
 
Methods inherited from class com.oroad.stxx.transform.AbstractXSLTransformer
getTemplates, getTemplatesFromCache, loadHandlers, putTemplates
 
Methods inherited from class com.oroad.stxx.transform.AbstractSAXTransformer
getFactory, setCache, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.oroad.stxx.transform.Transformer
setCache
 

Field Detail

mimeType

protected java.lang.String mimeType
The format type to return


allowRenderParameter

protected boolean allowRenderParameter
If the type of render can be specified as a request parameter


autoReloadTemplates

protected boolean autoReloadTemplates
If stylesheets will be automatically reloaded


isPlugin

protected boolean isPlugin
Constructor Detail

CachedXSLTransformer

public CachedXSLTransformer()
Constructor

Method Detail

init

public void init(java.lang.String name,
                 StxxProperties props,
                 javax.servlet.ServletContext context,
                 BuilderRules rules)
Initializes the transformer

Specified by:
init in interface Transformer
Overrides:
init in class AbstractXSLTransformer
Parameters:
name - The name of the transformer
props - The properties
context - The servlet context
rules - The builder rules

transform

public void transform(ActionTransform trans,
                      javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws TransformerException
Handles the transform stage by creating XML from the request and transforming it with one or more XSL files. The output is written to response's outputstream.

Specified by:
transform in interface Transformer
Specified by:
transform in class AbstractSAXTransformer
Parameters:
trans - The value object holding transformation information
response - The response object (to set content-type, etc)
request - The request object
Throws:
TransformerException - If something goes wrong

getXMLConsumer

protected XMLConsumer getXMLConsumer(javax.xml.transform.sax.TransformerHandler handler)
Creates the XMLConsumer that will be passed to the document builder. To add to XMLConsumers to the transformation process, override this method and add the desired XMLConsumers before the passed TransformerHandler.

Parameters:
handler - The first XSL stylesheet to process the XML
Returns:
The XMLConsumer to send the SAX events into, presumably the wrapped TransformerHandler