com.ibm.wbi.protocol.http.beans
Class XslEditor

com.ibm.wbi.Meg
  |
  +--com.ibm.wbi.Editor
        |
        +--com.ibm.wbi.protocol.http.HttpEditor
              |
              +--com.ibm.wbi.protocol.http.beans.XslEditor

public class XslEditor
extends HttpEditor

An Editor that translates XML (eXtensible Markup Language) documents according to an externally specified stylesheet (XSL = eXtensible Stylesheet Language). In order to use this class you need to have an XML 4 Java Parser, version 2.0.15 and the Lotus XSL Processor, version 0.17.4. Both packages are available at the IBM Alphaworks web site.


Field Summary
static java.lang.String COPYRIGHT
          IBM copyright information
 
Fields inherited from class com.ibm.wbi.protocol.http.HttpEditor
COPYRIGHT
 
Fields inherited from class com.ibm.wbi.Meg
COPYRIGHT, EDITOR, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED
 
Constructor Summary
XslEditor()
           
 
Method Summary
 java.lang.String getContentType()
          Gets the currently set content type for the result of a transformation.
 com.ibm.wbi.protocol.http.beans.TXDocument getXsl()
          Retrieve the XSL stylesheet used for transformations.
 void handleRequest(RequestEvent e)
          Called during a transaction.
protected  com.ibm.wbi.protocol.http.beans.TXDocument parseXmlSource(java.io.InputStream is)
           
 void setContentType(java.lang.String type)
          Sets the content type for the result of a transformation.
 void setXsl(java.io.File file)
          Sets the XSL stylesheet to use for transformations.
 void setXsl(java.io.InputStream is)
          Sets the XSL stylesheet to use for transformations.
 void setXsl(RequestEvent e, java.lang.String url)
          Sets the XSL stylesheet to use for transformations.
 void setXsl(com.ibm.wbi.protocol.http.beans.TXDocument doc)
          Sets the XSL stylesheet to use for transformations.
 
Methods inherited from class com.ibm.wbi.Editor
addMonitor, getMonitors, getType, isMonitors
 
Methods inherited from class com.ibm.wbi.Meg
forwardRequest, getCondition, getEnabled, getMegProperty, getMegProperty, getMegPropertyKeys, getName, getPlugin, getPriority, getSystemContext, initialize, initialize, isEnabled, isMegApplicable, loadMegResources, setCondition, setEnabled, setMegProperty, setName, setPriority, setSystemContext, setup, setup, setup, setup
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
IBM copyright information
Constructor Detail

XslEditor

public XslEditor()
Method Detail

setXsl

public void setXsl(com.ibm.wbi.protocol.http.beans.TXDocument doc)
Sets the XSL stylesheet to use for transformations.
Parameters:
doc - The document object representing the stylesheet.

setXsl

public void setXsl(java.io.InputStream is)
            throws java.io.IOException
Sets the XSL stylesheet to use for transformations.
Parameters:
is - The input stream containing the stylesheet.

setXsl

public void setXsl(java.io.File file)
            throws java.io.IOException
Sets the XSL stylesheet to use for transformations.
Parameters:
file - The file containing the stylesheet.

setXsl

public void setXsl(RequestEvent e,
                   java.lang.String url)
            throws java.io.IOException
Sets the XSL stylesheet to use for transformations. This methohd can be used if the necessary stylesheet is not avaialable locally but the file can be downloaded from a give location.
Parameters:
e - A request event object.
url - Location of the stylesheet.

getXsl

public com.ibm.wbi.protocol.http.beans.TXDocument getXsl()
Retrieve the XSL stylesheet used for transformations.
Returns:
The document representing the stylesheet.

setContentType

public void setContentType(java.lang.String type)
Sets the content type for the result of a transformation.
Parameters:
type - The content type. e.g. text/html.

getContentType

public java.lang.String getContentType()
Gets the currently set content type for the result of a transformation.
Returns:
The content type. e.g. text/html.

handleRequest

public void handleRequest(RequestEvent e)
                   throws RequestRejectedException,
                          java.io.IOException
Called during a transaction. This method parses the XML source and tries to transform it according to the specified stylesheet.
Overrides:
handleRequest in class HttpEditor
Parameters:
e - The current request event.
Throws:
java.io.Exception - if the XSL transformation failed.

parseXmlSource

protected com.ibm.wbi.protocol.http.beans.TXDocument parseXmlSource(java.io.InputStream is)
                                                             throws java.io.IOException