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.BodyTagSupport
Support 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 class
TransformSupport.JstlUriResolver
Lets us resolve relative external entities.private static class
TransformSupport.SafeWriter
A 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.DocumentBuilder
db
protected javax.xml.transform.Result
result
private int
scope
private javax.xml.transform.Transformer
t
private javax.xml.transform.TransformerFactory
tf
private java.lang.String
var
protected java.lang.Object
xml
protected boolean
xmlSpecified
protected java.lang.String
xmlSystemId
protected java.lang.Object
xslt
protected java.lang.String
xsltSystemId
-
Constructor Summary
Constructors Constructor Description TransformSupport()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameter(java.lang.String name, java.lang.Object value)
Sets (adds) a transformation parameter on our transformer.int
doEndTag()
int
doStartTag()
(package private) javax.xml.transform.Source
getDocumentFromBodyContent()
Return the Source for a document specified as body content.(package private) javax.xml.transform.Source
getSource(java.io.Reader reader, java.lang.String systemId)
Create a Source from a Reader(package private) javax.xml.transform.Source
getSourceFromXmlAttribute()
Return the Source for a document specified in the "doc" or "xml" attribute.(package private) javax.xml.transform.Transformer
getTransformer(java.lang.Object xslt, java.lang.String systemId)
Create a Transformer from the xslt attribute.private void
init()
void
release()
void
setPageContext(javax.servlet.jsp.PageContext pageContext)
void
setScope(java.lang.String scope)
void
setVar(java.lang.String var)
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.-
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:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
doEndTag
public int doEndTag() throws javax.servlet.jsp.JspException
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
-
release
public void release()
- Specified by:
release
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
release
in classjavax.servlet.jsp.tagext.BodyTagSupport
-
setPageContext
public void setPageContext(javax.servlet.jsp.PageContext pageContext)
- Specified by:
setPageContext
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
setPageContext
in 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.JspException
Create 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.JspTagException
Return 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.JspTagException
Return 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.JspTagException
Create 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)
-
-