Class TransformSupport
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.tagext.BodyTagSupport
-
- org.apache.taglibs.standard.tag.common.xml.TransformSupport
-
- All Implemented Interfaces:
java.io.Serializable,javax.servlet.jsp.tagext.BodyTag,javax.servlet.jsp.tagext.IterationTag,javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.tagext.Tag
- Direct Known Subclasses:
TransformTag,TransformTag
public abstract class TransformSupport extends javax.servlet.jsp.tagext.BodyTagSupportSupport for tag handlers for <transform>, the XML transformation tag.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classTransformSupport.JstlUriResolverLets us resolve relative external entities.private static classTransformSupport.SafeWriterA Writer based on a wrapped Writer but ignoring requests to close() and flush() it.
-
Field Summary
Fields Modifier and Type Field Description private javax.xml.parsers.DocumentBuilderdbprotected javax.xml.transform.Resultresultprivate intscopeprivate javax.xml.transform.Transformertprivate javax.xml.transform.TransformerFactorytfprivate java.lang.Stringvarprotected java.lang.Objectxmlprotected booleanxmlSpecifiedprotected java.lang.StringxmlSystemIdprotected java.lang.Objectxsltprotected java.lang.StringxsltSystemId
-
Constructor Summary
Constructors Constructor Description TransformSupport()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(java.lang.String name, java.lang.Object value)Sets (adds) a transformation parameter on our transformer.intdoEndTag()intdoStartTag()(package private) javax.xml.transform.SourcegetDocumentFromBodyContent()Return the Source for a document specified as body content.(package private) javax.xml.transform.SourcegetSource(java.io.Reader reader, java.lang.String systemId)Create a Source from a Reader(package private) javax.xml.transform.SourcegetSourceFromXmlAttribute()Return the Source for a document specified in the "doc" or "xml" attribute.(package private) javax.xml.transform.TransformergetTransformer(java.lang.Object xslt, java.lang.String systemId)Create a Transformer from the xslt attribute.private voidinit()voidrelease()voidsetPageContext(javax.servlet.jsp.PageContext pageContext)voidsetScope(java.lang.String scope)voidsetVar(java.lang.String var)private static java.lang.StringwrapSystemId(java.lang.String systemId)Wraps systemId with a "jstl:" prefix to prevent the parser from thinking that the URI is truly relative and resolving it against the current directory in the filesystem.-
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
-
-
-
-
Field Detail
-
xml
protected java.lang.Object xml
-
xmlSpecified
protected boolean xmlSpecified
-
xmlSystemId
protected java.lang.String xmlSystemId
-
xslt
protected java.lang.Object xslt
-
xsltSystemId
protected java.lang.String xsltSystemId
-
result
protected javax.xml.transform.Result result
-
var
private java.lang.String var
-
scope
private int scope
-
t
private javax.xml.transform.Transformer t
-
tf
private javax.xml.transform.TransformerFactory tf
-
db
private javax.xml.parsers.DocumentBuilder db
-
-
Method Detail
-
init
private void init()
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspException- Specified by:
doStartTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doStartTagin classjavax.servlet.jsp.tagext.BodyTagSupport- Throws:
javax.servlet.jsp.JspException
-
doEndTag
public int doEndTag() throws javax.servlet.jsp.JspException- Specified by:
doEndTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doEndTagin classjavax.servlet.jsp.tagext.BodyTagSupport- Throws:
javax.servlet.jsp.JspException
-
release
public void release()
- Specified by:
releasein interfacejavax.servlet.jsp.tagext.Tag- Overrides:
releasein classjavax.servlet.jsp.tagext.BodyTagSupport
-
setPageContext
public void setPageContext(javax.servlet.jsp.PageContext pageContext)
- Specified by:
setPageContextin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
setPageContextin classjavax.servlet.jsp.tagext.TagSupport
-
addParameter
public void addParameter(java.lang.String name, java.lang.Object value)Sets (adds) a transformation parameter on our transformer.
-
wrapSystemId
private static java.lang.String wrapSystemId(java.lang.String systemId)
Wraps systemId with a "jstl:" prefix to prevent the parser from thinking that the URI is truly relative and resolving it against the current directory in the filesystem.
-
getTransformer
javax.xml.transform.Transformer getTransformer(java.lang.Object xslt, java.lang.String systemId) throws javax.servlet.jsp.JspExceptionCreate a Transformer from the xslt attribute.- Parameters:
xslt- the xslt attributesystemId- the systemId for the transform- Returns:
- an XSLT transformer
- Throws:
javax.servlet.jsp.JspException- if there was a problem creating the transformer
-
getSourceFromXmlAttribute
javax.xml.transform.Source getSourceFromXmlAttribute() throws javax.servlet.jsp.JspTagExceptionReturn the Source for a document specified in the "doc" or "xml" attribute.- Returns:
- the document Source
- Throws:
javax.servlet.jsp.JspTagException- if there is a problem with the attribute
-
getDocumentFromBodyContent
javax.xml.transform.Source getDocumentFromBodyContent() throws javax.servlet.jsp.JspTagExceptionReturn the Source for a document specified as body content.- Returns:
- the document Source
- Throws:
javax.servlet.jsp.JspTagException- if there is a problem with the body content
-
getSource
javax.xml.transform.Source getSource(java.io.Reader reader, java.lang.String systemId) throws javax.servlet.jsp.JspTagExceptionCreate a Source from a Reader- Parameters:
reader- the Reader to readsystemId- the systemId for the document- Returns:
- a SAX Source
- Throws:
javax.servlet.jsp.JspTagException- if there is a problem creating the Source
-
setVar
public void setVar(java.lang.String var)
-
setScope
public void setScope(java.lang.String scope)
-
-