Milyn-Smooks Version 0.4

org.milyn.delivery
Class SmooksHtml

java.lang.Object
  extended byorg.milyn.delivery.SmooksHtml

public class SmooksHtml
extends java.lang.Object

Smooks HTML content manipulation and delivery class.

This executes the 3 phases of HTML content delivery. The Assembly and Transformation phases are executed by the applyTransform(Document) method and the Serialisation phase is performed by the serailize(Node, Writer) method.

This class will be controlled by a container specific class. At the moment Smooks is only supported in the J2EE Servlet Container and this class is hooked into the process through the HtmlServletResponseWrapper. class.

Author:
tfennelly

Field Summary
static java.lang.String DELIVERY_NODE_REQUEST_KEY
          Key under which a non-document content delivery node can be set in the request.
 
Constructor Summary
SmooksHtml(ContainerRequest containerRequest)
          Public constructor.
 
Method Summary
 org.w3c.dom.Node applyTransform(org.w3c.dom.Document doc)
          Transform the supplied W3C Document.
 org.w3c.dom.Node applyTransform(java.io.Reader source)
          Transform the supplied InputSource.
 void serailize(org.w3c.dom.Node node, java.io.Writer writer)
          Serialise the node to the supplied output writer instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELIVERY_NODE_REQUEST_KEY

public static final java.lang.String DELIVERY_NODE_REQUEST_KEY
Key under which a non-document content delivery node can be set in the request. This is needed because Xerces doesn't allow "overwriting" of the document root node.

Constructor Detail

SmooksHtml

public SmooksHtml(ContainerRequest containerRequest)
Public constructor.

Constructs a Smooks instance for delivering content to the target device associated with the uaContext.

Parameters:
containerRequest - Container request for this Smooks content delivery instance.
Method Detail

applyTransform

public org.w3c.dom.Node applyTransform(java.io.Reader source)
                                throws SmooksException
Transform the supplied InputSource.

Simply parses the InputSource into a W3C DOM and calls applyTransform(Document).

Parameters:
source - The source of markup to be transformed.
Returns:
Node representing transformed document; content to be delivered.
Throws:
SmooksException

applyTransform

public org.w3c.dom.Node applyTransform(org.w3c.dom.Document doc)
Transform the supplied W3C Document.

Executes the Assembly and Transformation phases.

Parameters:
doc - The W3C Document to be transformed.
Returns:
Node representing transformed document; content to be delivered.

serailize

public void serailize(org.w3c.dom.Node node,
                      java.io.Writer writer)
               throws java.io.IOException,
                      SmooksException
Serialise the node to the supplied output writer instance.

Executes the Serialisation phase, using the Serializer class to perform the serialization.

Parameters:
node - Document to be serialised.
writer - Output writer.
Throws:
CDRArchiveEntryNotFoundException - DOM Serialiser exception.
java.io.IOException - Unable to write to output writer.
SmooksException - Unable to serialise do to bad Smooks environment. Check cause.

Milyn-Smooks Version 0.4