net.sourceforge.cruisecontrol.taglib
Class XSLTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
net.sourceforge.cruisecontrol.taglib.CruiseControlTagSupport
net.sourceforge.cruisecontrol.taglib.XSLTag
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.jsp.tagext.Tag
- public class XSLTag
- extends CruiseControlTagSupport
JSP custom tag to handle xsl transforms. This tag also caches the output of the transform to disk, reducing the
number of transforms necessary.
- Author:
- alden almagro, ThoughtWorks, Inc. 2002, Hack Kampbjorn
- See Also:
- Serialized Form
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id, pageContext |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Method Summary |
int |
doEndTag()
|
protected java.lang.String |
getCachedCopyFileName(java.io.File xmlFile)
Create a filename for the cached copy of this transform. |
protected boolean |
isCacheFileCurrent(java.io.File xmlFile,
java.io.File cacheFile)
Determine whether the cache file is current or not. |
void |
release()
|
protected void |
serveCachedCopy(java.io.File cacheFile,
java.io.Writer out)
Serves the cached copy rather than re-performing the xsl transform for every request. |
void |
setXslFile(java.lang.String xslFile)
Sets the xsl file to use. |
protected void |
transform(LogFile xmlFile,
java.net.URL style,
java.io.OutputStream out)
Perform an xsl transform. |
protected void |
updateCacheFile(LogFile xmlFile,
java.io.File cacheFile)
|
Methods inherited from class net.sourceforge.cruisecontrol.taglib.CruiseControlTagSupport |
createUrl, createUrl, debug, debug, err, err, err, findLogDir, findLogFile, findProjects, getBaseLogDir, getContextParam, getLocale, getLog, getPageContext, getProject, getRequest, getServletPath, info, isSingleProject, setPageContext, setProject |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XSLTag
public XSLTag()
release
public void release()
transform
protected void transform(LogFile xmlFile,
java.net.URL style,
java.io.OutputStream out)
throws javax.servlet.jsp.JspTagException
- Perform an xsl transform. This body of this method is based upon the xalan sample code.
- Parameters:
xmlFile
- the xml file to be transformedstyle
- resource containing the xsl stylesheetout
- stream to output the results of the transformation
- Throws:
javax.servlet.jsp.JspTagException
isCacheFileCurrent
protected boolean isCacheFileCurrent(java.io.File xmlFile,
java.io.File cacheFile)
- Determine whether the cache file is current or not. The file will be current if it is newer than both the
xml log file and the xsl file used to create it.
- Returns:
- true if the cache file is current.
serveCachedCopy
protected void serveCachedCopy(java.io.File cacheFile,
java.io.Writer out)
throws javax.servlet.jsp.JspTagException
- Serves the cached copy rather than re-performing the xsl transform for every request.
- Parameters:
cacheFile
- The filename of the cached copy of the transform.out
- The writer to write to
- Throws:
javax.servlet.jsp.JspTagException
getCachedCopyFileName
protected java.lang.String getCachedCopyFileName(java.io.File xmlFile)
- Create a filename for the cached copy of this transform. This filename will be the concatenation of the
log file and the xsl file used to create it.
- Parameters:
xmlFile
- The log file used as input to the transform
- Returns:
- The filename for the cached file
setXslFile
public void setXslFile(java.lang.String xslFile)
- Sets the xsl file to use. It is expected that this can be found by the
ServletContext
for this
web application.
- Parameters:
xslFile
- The path to the xslFile.
updateCacheFile
protected void updateCacheFile(LogFile xmlFile,
java.io.File cacheFile)
throws javax.servlet.jsp.JspTagException
- Throws:
javax.servlet.jsp.JspTagException
doEndTag
public int doEndTag()
throws javax.servlet.jsp.JspException
- Throws:
javax.servlet.jsp.JspException