org.ibisph.mvc.view
Class XSLTXMLTransformation

java.lang.Object
  extended by org.ibisph.mvc.view.XSLTXMLTransformation
All Implemented Interfaces:
org.springframework.web.servlet.View

public class XSLTXMLTransformation
extends java.lang.Object
implements org.springframework.web.servlet.View

Base/core XML/XSLT Transformation View. The view is based on an XSLT System ID resource which is passed in via the constructor (required) and a mostly required but optional XML file/document which is passed to the render method in the model map. This view forms the main view component for the IBISPH-View application as most of pages are created with a XSLT stylesheet merging in XML data content.

Author:
Garth Braithwaite, STG

Field Summary
protected  java.util.Properties extraParameters
           
protected  java.lang.String parametersMapModelName
           
protected  java.lang.String responseContentType
           
protected  Transformation transformation
           
protected  java.lang.String xmlModelName
           
protected  SystemID xmlSystemIDResource
           
protected  java.lang.String xsltModelName
           
protected  SystemID xsltSystemIDResource
           
 
Constructor Summary
XSLTXMLTransformation(SystemID xsltSystemIDResource, Transformation transformation)
          Constructor with required resources.
 
Method Summary
 java.lang.String getContentType()
          Spring View required method that the request dispatcher servlet probably calls to set the response content type.
 void render(java.util.Map model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Spring framework MVC View Render method for XSLT/XML transformation view requests.
 void setContentType(java.lang.String responseContentType)
          Sets the default HTTP response content type.
 void setExtraParameters(java.util.Properties extraParameters)
          Mechanism that allows a static list of deployment defined name/value pairs of strings to be sent to the XSLT transformation process (as parameters).
 void setParametersMapModelName(java.lang.String parametersMapModelName)
          Sets extra parameters map model name/key value.
 void setTransformation(Transformation transformation)
          Sets the XML/XSLT transformation object.
 void setXMLModelName(java.lang.String xmlModelName)
          Sets XML model name map key value.
 void setXMLSystemIDResource(SystemID xmlSystemIDResource)
          Sets the XML System ID for the model portion of the Spring MVC framework.
 void setXSLTModelName(java.lang.String xsltModelName)
          Provides a way to specify the XSLT System ID model name.
 void setXSLTSystemIDResource(SystemID xsltSystemIDResource)
          Sets the XSLT System ID for the view portion of the Spring MVC framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlSystemIDResource

protected SystemID xmlSystemIDResource

xsltSystemIDResource

protected SystemID xsltSystemIDResource

transformation

protected Transformation transformation

xsltModelName

protected java.lang.String xsltModelName

xmlModelName

protected java.lang.String xmlModelName

parametersMapModelName

protected java.lang.String parametersMapModelName

extraParameters

protected java.util.Properties extraParameters

responseContentType

protected java.lang.String responseContentType
Constructor Detail

XSLTXMLTransformation

public XSLTXMLTransformation(SystemID xsltSystemIDResource,
                             Transformation transformation)
Constructor with required resources.

Parameters:
xsltSystemIDResource - XSLT system ID for this view instance.
transformation - XSLT transformation/transformer to be used for this view instance.
Method Detail

setXMLModelName

public void setXMLModelName(java.lang.String xmlModelName)
Sets XML model name map key value. This key/name value is how the controller and view components are able access the model portion of the Spring MVC framework.

Parameters:
xmlModelName - XML map model key that the controller and view use to access the model from the map.

setXSLTModelName

public void setXSLTModelName(java.lang.String xsltModelName)
Provides a way to specify the XSLT System ID model name. If the XSLT model name is present in the model map, then this value is used. Else the XSLT system id resource property is used. This does not really belong as part of the model but is an option in case the controller needs to specify it.

Parameters:
xsltModelName - model map key for the XSLT system id or filename and path string.

setParametersMapModelName

public void setParametersMapModelName(java.lang.String parametersMapModelName)
Sets extra parameters map model name/key value. This key is set by the controller needed by the view to get any extra parameters from the model map which need to be passed to the XSLT transformer.

Parameters:
parametersMapModelName - Parameters map key that the controller used to put any/all parameters into the model map.

setXMLSystemIDResource

public void setXMLSystemIDResource(SystemID xmlSystemIDResource)
Sets the XML System ID for the model portion of the Spring MVC framework. If a model does not exist in the model map then this value is used for the XML model.

Parameters:
xmlSystemIDResource - XML data file's system ID to be used for the XML/XSLT transformation.

setXSLTSystemIDResource

public void setXSLTSystemIDResource(SystemID xsltSystemIDResource)
Sets the XSLT System ID for the view portion of the Spring MVC framework. The XSLT System ID is first checked to be set within the model map. If not found then this property is used.

Parameters:
xsltSystemIDResource - XSLT system ID to be used for the XML/XSLT transformation.

setTransformation

public void setTransformation(Transformation transformation)
Sets the XML/XSLT transformation object.

Parameters:
transformation - Required XML/XSLT transformation object that does the actual work.

setExtraParameters

public void setExtraParameters(java.util.Properties extraParameters)
Mechanism that allows a static list of deployment defined name/value pairs of strings to be sent to the XSLT transformation process (as parameters).

Parameters:
extraParameters - property list of extra parameters that are sent to the transformation process to be included as parameters that the XSLT can use.

setContentType

public void setContentType(java.lang.String responseContentType)
Sets the default HTTP response content type.

Parameters:
responseContentType - Default HTTP content type. This value is not validated.

getContentType

public java.lang.String getContentType()
Spring View required method that the request dispatcher servlet probably calls to set the response content type.

Specified by:
getContentType in interface org.springframework.web.servlet.View
Returns:
this objects content type property value.

render

public void render(java.util.Map model,
                   javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.lang.Exception
Spring framework MVC View Render method for XSLT/XML transformation view requests. The model map is checked for an XSLT and XML object. If found these are used for the transformation. If not found then the default XML and XSLT system ID properties are used. The model map parameters and any extra parameters are then added to the transformation parameters and the resultant transformation is then streamed back to the response's output stream.

Specified by:
render in interface org.springframework.web.servlet.View
Parameters:
model - Spring framework MVC model map which contains XML data and other request parameters that need to be passed to the XSLT.
request - HTTP request passed from Spring MVC framework. This is used to get the application's content which is put into the WebAppURLContextPrefix parameter. This parameter allows the XSLT to build the appropriate HTML link references.
response - HTTP response passed from Spring MVC framework. This is used to get the output stream for the transformed contents.
Throws:
java.io.IOException - Associated stream exceptions.
java.lang.Exception