|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.scopemvc.view.servlet.Page | +--org.scopemvc.view.servlet.xml.AbstractXSLPage
A ServletView that references an XSLT URI used to transform an XML representation of the View's bound model objects.
The XSLT is assumed to describe the entire view, not just a part of the overall page, even when this view is a subview or a parent of subviews.
Model objects are turned to a SAX source in a concrete subclass, which is transformed with the XSLT to a SAX stream that gets fed to a SAX ContentHandler (eg an HTML serializer) that writes to an OutputStream (eg the HTTPResponse's output stream).
This abstract base class does some generic XSLT handling, including caching
compiled stylesheets. The concrete Scope impl is in XSLPage
.
Field Summary | |
protected java.lang.String |
debugXMLDirectory
Filesystem directory to dump all XML before transforming. |
protected boolean |
shouldCacheTemplates
Do we want to cache the stylesheets? Yes for production, no for development because you want to see changes to the XSLTs as soon as you make them rather than after restarting the web application. |
protected static java.util.HashMap |
templateCache
A cache for compiled stylesheets. |
protected java.lang.String |
xslURI
URI of the XSLT for this View relative to the setSystemID(java.lang.String) . |
Constructor Summary | |
AbstractXSLPage(java.lang.String inViewID,
java.lang.String inXslURI)
Specify the XSLT to use when showing this View. |
Method Summary | |
protected abstract void |
generateXMLDocument(org.xml.sax.ContentHandler inContentHandler)
Override to implement model to SAX conversion into the passed ContentHandler. |
java.lang.String |
getContentType()
Allow subclasses to deliver different content types. |
protected java.util.Properties |
getHTMLOutputProperties()
Make Properties for Transformer.setOutputProperties suitable
for final HTML output. |
static java.lang.String |
getSystemID()
Where XSLT URIs are referenced relative to. |
protected javax.xml.transform.sax.TransformerHandler |
getTransformerHandler(java.io.OutputStream inOutputStream)
Thread-safe Templates are cached for reuse to avoid parsing and compiling stylesheets repeatedly. |
protected java.util.Properties |
getXMLOutputProperties()
Make Properties for Transformer.setOutputProperties suitable
for debug XML output. |
java.lang.String |
getXslURI()
The XSLT that will be shown for this view. |
protected org.xml.sax.ContentHandler |
makeSerializer(java.io.OutputStream inStream,
java.util.Properties inOutputProperties)
Make a null transformer to take SAX input and stream it to an OutputStream using the passed OutputProperties. |
static void |
setSystemID(java.lang.String inSystemID)
Where XSLT URIs are referenced relative to. |
void |
setXslURI(java.lang.String inURI)
The XSLT that will be shown for this view. |
void |
streamView(java.io.OutputStream inOutputStream)
Stream the view by calling generateXMLDocument(org.xml.sax.ContentHandler) and processing
the result with the XSLT. |
java.lang.String |
toString()
For debug. |
Methods inherited from class org.scopemvc.view.servlet.Page |
equalsID, getBoundModel, getController, getID, getParent, issueControl, populateModel, setBoundModel, setController, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static java.util.HashMap templateCache
protected boolean shouldCacheTemplates
protected java.lang.String xslURI
setSystemID(java.lang.String)
. The
XSLT is assumed to be for the whole page, even if this view is a subview
of a parent.
protected java.lang.String debugXMLDirectory
Constructor Detail |
public AbstractXSLPage(java.lang.String inViewID, java.lang.String inXslURI)
inXslURI
- a URI to the XSLT relative to what has been set in setSystemID(java.lang.String)
inViewID
- TODO: Describe the ParameterMethod Detail |
public static java.lang.String getSystemID()
public static void setSystemID(java.lang.String inSystemID)
inSystemID
- The new systemID valuepublic java.lang.String getXslURI()
public java.lang.String getContentType()
public void setXslURI(java.lang.String inURI)
inURI
- The new xslURI valuepublic java.lang.String toString()
toString
in class java.lang.Object
public void streamView(java.io.OutputStream inOutputStream) throws java.lang.Exception
Stream the view by calling generateXMLDocument(org.xml.sax.ContentHandler)
and processing
the result with the XSLT.
inOutputStream
- Stream the result of the XSLT processing into here.
java.lang.Exception
- TODO: Describe the Exceptionprotected java.util.Properties getXMLOutputProperties()
Transformer.setOutputProperties
suitable
for debug XML output.
OutputKeys
protected java.util.Properties getHTMLOutputProperties()
Transformer.setOutputProperties
suitable
for final HTML output.
OutputKeys
protected javax.xml.transform.sax.TransformerHandler getTransformerHandler(java.io.OutputStream inOutputStream) throws java.lang.Exception
inOutputStream
- TODO: Describe the Parameter
java.lang.Exception
- TODO: Describe the Exceptionprotected org.xml.sax.ContentHandler makeSerializer(java.io.OutputStream inStream, java.util.Properties inOutputProperties)
inStream
- TODO: Describe the ParameterinOutputProperties
- TODO: Describe the Parameter
getXMLOutputProperties()
,
getHTMLOutputProperties()
protected abstract void generateXMLDocument(org.xml.sax.ContentHandler inContentHandler) throws java.lang.Exception
inContentHandler
- TODO: Describe the Parameter
java.lang.Exception
- TODO: Describe the Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |