Package com.sun.xml.messaging.saaj.soap
Class SOAPPartImpl
- java.lang.Object
-
- jakarta.xml.soap.SOAPPart
-
- com.sun.xml.messaging.saaj.soap.SOAPPartImpl
-
- All Implemented Interfaces:
SOAPDocument,Node,Document,Node
- Direct Known Subclasses:
SOAPPart1_1Impl,SOAPPart1_2Impl
public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument
SOAPPartImpl is the first attachment. This contains the XML/SOAP document.- Author:
- Anil Vijendran (anil@sun.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected SOAPDocumentImpldocumentprotected Envelopeenvelopeprotected MimeHeadersheadersprotected MessageImplmessageReference to containing message (may be null)protected booleanomitXmlDeclprotected Sourcesourceprotected StringsourceCharsetEncoding-
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSOAPPartImpl()protectedSOAPPartImpl(MessageImpl message)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddMimeHeader(String name, String value)Creates aMimeHeaderobject with the specified name and value and adds it to thisSOAPPartobject.NodeadoptNode(Node source)NodeappendChild(Node newChild)NodecloneNode(boolean deep)shortcompareDocumentPosition(Node other)AttrcreateAttribute(String name)AttrcreateAttributeNS(String namespaceURI, String qualifiedName)CDATASectioncreateCDATASection(String data)CommentcreateComment(String data)DocumentFragmentcreateDocumentFragment()ElementcreateElement(String tagName)ElementcreateElementNS(String namespaceURI, String qualifiedName)protected abstract EnvelopecreateEmptyEnvelope(String prefix)EntityReferencecreateEntityReference(String name)protected abstract EnvelopecreateEnvelopeFromSource()ProcessingInstructioncreateProcessingInstruction(String target, String data)TextcreateTextNode(String data)voiddetachNode()Removes thisNodeobject from the tree.protected SOAPPartImpldoCloneNode()protected voiddoGetDocumentElement()protected abstract SOAPPartImplduplicateType()Iterator<MimeHeader>getAllMimeHeaders()Retrieves all the headers for thisSOAPPartobject as an iterator over theMimeHeaderobjects.NamedNodeMapgetAttributes()StringgetBaseURI()NodeListgetChildNodes()SourcegetContent()Returns the content of the SOAPEnvelope as a JAXPSourceobject.InputStreamgetContentAsStream()protected abstract StringgetContentType()protected StringgetContentTypeString()DocumentTypegetDoctype()SOAPDocumentImplgetDocument()ElementgetDocumentElement()StringgetDocumentURI()DOMConfigurationgetDomConfig()ElementgetElementById(String elementId)NodeListgetElementsByTagName(String tagname)NodeListgetElementsByTagNameNS(String namespaceURI, String localName)SOAPEnvelopegetEnvelope()Gets theSOAPEnvelopeobject associated with thisSOAPPartobject.ObjectgetFeature(String feature, String version)NodegetFirstChild()DOMImplementationgetImplementation()StringgetInputEncoding()NodegetLastChild()StringgetLocalName()Iterator<MimeHeader>getMatchingMimeHeaders(String[] names)Retrieves allMimeHeaderobjects that match a name in the given array.String[]getMimeHeader(String name)Gets all the values of theMimeHeaderobject in thisSOAPPartobject that is identified by the givenString.StringgetNamespaceURI()NodegetNextSibling()StringgetNodeName()shortgetNodeType()StringgetNodeValue()Iterator<MimeHeader>getNonMatchingMimeHeaders(String[] names)Retrieves allMimeHeaderobjects whose name does not match a name in the given array.DocumentgetOwnerDocument()SOAPElementgetParentElement()Returns the parent element of thisNodeobject.NodegetParentNode()StringgetPrefix()NodegetPreviousSibling()abstract StringgetSOAPNamespace()SOAPPartImplgetSOAPPart()StringgetSourceCharsetEncoding()booleangetStrictErrorChecking()StringgetTextContent()ObjectgetUserData(String key)StringgetValue()Returns the value of this node if this is aTextnode or the value of the immediate child of this node otherwise.StringgetXmlEncoding()booleangetXmlStandalone()StringgetXmlVersion()booleanhasAttributes()booleanhasChildNodes()NodeimportNode(Node importedNode, boolean deep)NodeinsertBefore(Node arg0, Node arg1)booleanisDefaultNamespace(String namespaceURI)booleanisEqualNode(Node arg)booleanisFastInfoset()booleanisSameNode(Node other)booleanisSupported(String arg0, String arg1)protected voidlookForEnvelope()protected XMLDeclarationParserlookForXmlDecl()StringlookupNamespaceURI(String prefix)StringlookupPrefix(String namespaceURI)voidnormalize()voidnormalizeDocument()voidrecycleNode()Notifies the implementation that thisNodeobject is no longer being used by the application and that the implementation is free to reuse this object for nodes that may be created later.voidremoveAllMimeHeaders()Removes all theMimeHeaderobjects for thisSOAPEnvelopeobject.NoderemoveChild(Node arg0)voidremoveMimeHeader(String header)Removes all MIME headers that match the given name.NoderenameNode(Node n, String namespaceURI, String qualifiedName)NodereplaceChild(Node arg0, Node arg1)voidsetContent(Source source)Sets the content of theSOAPEnvelopeobject with the data from the givenSourceobject.voidsetDocumentURI(String documentURI)voidsetMimeHeader(String name, String value)Changes the first header entry that matches the given header name so that its value is the given value, adding a new header with the given name and value if no existing header is a match.voidsetNodeValue(String arg0)voidsetParentElement(SOAPElement parent)Sets the parent of thisNodeobject to the givenSOAPElementobject.voidsetPrefix(String arg0)voidsetSourceCharsetEncoding(String charset)voidsetStrictErrorChecking(boolean strictErrorChecking)voidsetTextContent(String textContent)ObjectsetUserData(String key, Object data, UserDataHandler handler)voidsetValue(String value)If this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) child of this node.voidsetXmlStandalone(boolean xmlStandalone)voidsetXmlVersion(String xmlVersion)-
Methods inherited from class jakarta.xml.soap.SOAPPart
getContentId, getContentLocation, setContentId, setContentLocation
-
-
-
-
Field Detail
-
headers
protected MimeHeaders headers
-
envelope
protected Envelope envelope
-
source
protected Source source
-
document
protected SOAPDocumentImpl document
-
omitXmlDecl
protected boolean omitXmlDecl
-
sourceCharsetEncoding
protected String sourceCharsetEncoding
-
message
protected MessageImpl message
Reference to containing message (may be null)
-
-
Constructor Detail
-
SOAPPartImpl
protected SOAPPartImpl()
-
SOAPPartImpl
protected SOAPPartImpl(MessageImpl message)
-
-
Method Detail
-
getContentType
protected abstract String getContentType()
-
createEnvelopeFromSource
protected abstract Envelope createEnvelopeFromSource() throws SOAPException
- Throws:
SOAPException
-
createEmptyEnvelope
protected abstract Envelope createEmptyEnvelope(String prefix) throws SOAPException
- Throws:
SOAPException
-
duplicateType
protected abstract SOAPPartImpl duplicateType()
-
getContentTypeString
protected String getContentTypeString()
-
isFastInfoset
public boolean isFastInfoset()
-
getEnvelope
public SOAPEnvelope getEnvelope() throws SOAPException
Description copied from class:SOAPPartGets theSOAPEnvelopeobject associated with thisSOAPPartobject. Once the SOAP envelope is obtained, it can be used to get its contents.- Specified by:
getEnvelopein classSOAPPart- Returns:
- the
SOAPEnvelopeobject for thisSOAPPartobject - Throws:
SOAPException- if there is a SOAP error
-
lookForEnvelope
protected void lookForEnvelope() throws SOAPException- Throws:
SOAPException
-
removeAllMimeHeaders
public void removeAllMimeHeaders()
Description copied from class:SOAPPartRemoves all theMimeHeaderobjects for thisSOAPEnvelopeobject.- Specified by:
removeAllMimeHeadersin classSOAPPart
-
removeMimeHeader
public void removeMimeHeader(String header)
Description copied from class:SOAPPartRemoves all MIME headers that match the given name.- Specified by:
removeMimeHeaderin classSOAPPart- Parameters:
header- aStringgiving the name of the MIME header(s) to be removed
-
getMimeHeader
public String[] getMimeHeader(String name)
Description copied from class:SOAPPartGets all the values of theMimeHeaderobject in thisSOAPPartobject that is identified by the givenString.- Specified by:
getMimeHeaderin classSOAPPart- Parameters:
name- the name of the header; example: "Content-Type"- Returns:
- a
Stringarray giving all the values for the specified header - See Also:
SOAPPart.setMimeHeader(java.lang.String, java.lang.String)
-
setMimeHeader
public void setMimeHeader(String name, String value)
Description copied from class:SOAPPartChanges the first header entry that matches the given header name so that its value is the given value, adding a new header with the given name and value if no existing header is a match. If there is a match, this method clears all existing values for the first header that matches and sets the given value instead. If more than one header has the given name, this method removes all of the matching headers after the first one.Note that RFC822 headers can contain only US-ASCII characters.
- Specified by:
setMimeHeaderin classSOAPPart- Parameters:
name- aStringgiving the header name for which to searchvalue- aStringgiving the value to be set. This value will be substituted for the current value(s) of the first header that is a match if there is one. If there is no match, this value will be the value for a newMimeHeaderobject.- See Also:
SOAPPart.getMimeHeader(java.lang.String)
-
addMimeHeader
public void addMimeHeader(String name, String value)
Description copied from class:SOAPPartCreates aMimeHeaderobject with the specified name and value and adds it to thisSOAPPartobject. If aMimeHeaderwith the specified name already exists, this method adds the specified value to the already existing value(s).Note that RFC822 headers can contain only US-ASCII characters.
- Specified by:
addMimeHeaderin classSOAPPart- Parameters:
name- aStringgiving the header namevalue- aStringgiving the value to be set or added
-
getAllMimeHeaders
public Iterator<MimeHeader> getAllMimeHeaders()
Description copied from class:SOAPPartRetrieves all the headers for thisSOAPPartobject as an iterator over theMimeHeaderobjects.- Specified by:
getAllMimeHeadersin classSOAPPart- Returns:
- an
Iteratorobject with all of the Mime headers for thisSOAPPartobject
-
getMatchingMimeHeaders
public Iterator<MimeHeader> getMatchingMimeHeaders(String[] names)
Description copied from class:SOAPPartRetrieves allMimeHeaderobjects that match a name in the given array.- Specified by:
getMatchingMimeHeadersin classSOAPPart- Parameters:
names- aStringarray with the name(s) of the MIME headers to be returned- Returns:
- all of the MIME headers that match one of the names in the
given array, returned as an
Iteratorobject
-
getNonMatchingMimeHeaders
public Iterator<MimeHeader> getNonMatchingMimeHeaders(String[] names)
Description copied from class:SOAPPartRetrieves allMimeHeaderobjects whose name does not match a name in the given array.- Specified by:
getNonMatchingMimeHeadersin classSOAPPart- Parameters:
names- aStringarray with the name(s) of the MIME headers not to be returned- Returns:
- all of the MIME headers in this
SOAPPartobject except those that match one of the names in the given array. The nonmatching MIME headers are returned as anIteratorobject.
-
getContent
public Source getContent() throws SOAPException
Description copied from class:SOAPPartReturns the content of the SOAPEnvelope as a JAXPSourceobject.- Specified by:
getContentin classSOAPPart- Returns:
- the content as a
javax.xml.transform.Sourceobject - Throws:
SOAPException- if the implementation cannot convert the specifiedSourceobject- See Also:
SOAPPart.setContent(javax.xml.transform.Source)
-
setContent
public void setContent(Source source) throws SOAPException
Description copied from class:SOAPPartSets the content of theSOAPEnvelopeobject with the data from the givenSourceobject. ThisSourcemust contain a valid SOAP document.- Specified by:
setContentin classSOAPPart- Parameters:
source- thejavax.xml.transform.Sourceobject with the data to be set- Throws:
SOAPException- if there is a problem in setting the source- See Also:
SOAPPart.getContent()
-
getContentAsStream
public InputStream getContentAsStream() throws IOException
- Throws:
IOException
-
getDocument
public SOAPDocumentImpl getDocument()
- Specified by:
getDocumentin interfaceSOAPDocument
-
getSOAPPart
public SOAPPartImpl getSOAPPart()
- Specified by:
getSOAPPartin interfaceSOAPDocument
-
getDoctype
public DocumentType getDoctype()
- Specified by:
getDoctypein interfaceDocument
-
getImplementation
public DOMImplementation getImplementation()
- Specified by:
getImplementationin interfaceDocument
-
getDocumentElement
public Element getDocumentElement()
- Specified by:
getDocumentElementin interfaceDocument
-
doGetDocumentElement
protected void doGetDocumentElement()
-
createElement
public Element createElement(String tagName) throws DOMException
- Specified by:
createElementin interfaceDocument- Throws:
DOMException
-
createDocumentFragment
public DocumentFragment createDocumentFragment()
- Specified by:
createDocumentFragmentin interfaceDocument
-
createTextNode
public Text createTextNode(String data)
- Specified by:
createTextNodein interfaceDocument
-
createComment
public Comment createComment(String data)
- Specified by:
createCommentin interfaceDocument
-
createCDATASection
public CDATASection createCDATASection(String data) throws DOMException
- Specified by:
createCDATASectionin interfaceDocument- Throws:
DOMException
-
createProcessingInstruction
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException
- Specified by:
createProcessingInstructionin interfaceDocument- Throws:
DOMException
-
createAttribute
public Attr createAttribute(String name) throws DOMException
- Specified by:
createAttributein interfaceDocument- Throws:
DOMException
-
createEntityReference
public EntityReference createEntityReference(String name) throws DOMException
- Specified by:
createEntityReferencein interfaceDocument- Throws:
DOMException
-
getElementsByTagName
public NodeList getElementsByTagName(String tagname)
- Specified by:
getElementsByTagNamein interfaceDocument
-
importNode
public Node importNode(Node importedNode, boolean deep) throws DOMException
- Specified by:
importNodein interfaceDocument- Throws:
DOMException
-
createElementNS
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException
- Specified by:
createElementNSin interfaceDocument- Throws:
DOMException
-
createAttributeNS
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException
- Specified by:
createAttributeNSin interfaceDocument- Throws:
DOMException
-
getElementsByTagNameNS
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
- Specified by:
getElementsByTagNameNSin interfaceDocument
-
getElementById
public Element getElementById(String elementId)
- Specified by:
getElementByIdin interfaceDocument
-
appendChild
public Node appendChild(Node newChild) throws DOMException
- Specified by:
appendChildin interfaceNode- Throws:
DOMException
-
doCloneNode
protected SOAPPartImpl doCloneNode()
-
getAttributes
public NamedNodeMap getAttributes()
- Specified by:
getAttributesin interfaceNode
-
getChildNodes
public NodeList getChildNodes()
- Specified by:
getChildNodesin interfaceNode
-
getFirstChild
public Node getFirstChild()
- Specified by:
getFirstChildin interfaceNode
-
getLastChild
public Node getLastChild()
- Specified by:
getLastChildin interfaceNode
-
getLocalName
public String getLocalName()
- Specified by:
getLocalNamein interfaceNode
-
getNamespaceURI
public String getNamespaceURI()
- Specified by:
getNamespaceURIin interfaceNode
-
getNextSibling
public Node getNextSibling()
- Specified by:
getNextSiblingin interfaceNode
-
getNodeName
public String getNodeName()
- Specified by:
getNodeNamein interfaceNode
-
getNodeType
public short getNodeType()
- Specified by:
getNodeTypein interfaceNode
-
getNodeValue
public String getNodeValue() throws DOMException
- Specified by:
getNodeValuein interfaceNode- Throws:
DOMException
-
getOwnerDocument
public Document getOwnerDocument()
- Specified by:
getOwnerDocumentin interfaceNode
-
getParentNode
public Node getParentNode()
- Specified by:
getParentNodein interfaceNode
-
getPreviousSibling
public Node getPreviousSibling()
- Specified by:
getPreviousSiblingin interfaceNode
-
hasAttributes
public boolean hasAttributes()
- Specified by:
hasAttributesin interfaceNode
-
hasChildNodes
public boolean hasChildNodes()
- Specified by:
hasChildNodesin interfaceNode
-
insertBefore
public Node insertBefore(Node arg0, Node arg1) throws DOMException
- Specified by:
insertBeforein interfaceNode- Throws:
DOMException
-
isSupported
public boolean isSupported(String arg0, String arg1)
- Specified by:
isSupportedin interfaceNode
-
removeChild
public Node removeChild(Node arg0) throws DOMException
- Specified by:
removeChildin interfaceNode- Throws:
DOMException
-
replaceChild
public Node replaceChild(Node arg0, Node arg1) throws DOMException
- Specified by:
replaceChildin interfaceNode- Throws:
DOMException
-
setNodeValue
public void setNodeValue(String arg0) throws DOMException
- Specified by:
setNodeValuein interfaceNode- Throws:
DOMException
-
setPrefix
public void setPrefix(String arg0) throws DOMException
- Specified by:
setPrefixin interfaceNode- Throws:
DOMException
-
lookForXmlDecl
protected XMLDeclarationParser lookForXmlDecl() throws SOAPException
- Throws:
SOAPException
-
setSourceCharsetEncoding
public void setSourceCharsetEncoding(String charset)
-
renameNode
public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException
- Specified by:
renameNodein interfaceDocument- Throws:
DOMException
-
normalizeDocument
public void normalizeDocument()
- Specified by:
normalizeDocumentin interfaceDocument
-
getDomConfig
public DOMConfiguration getDomConfig()
- Specified by:
getDomConfigin interfaceDocument
-
adoptNode
public Node adoptNode(Node source) throws DOMException
- Specified by:
adoptNodein interfaceDocument- Throws:
DOMException
-
setDocumentURI
public void setDocumentURI(String documentURI)
- Specified by:
setDocumentURIin interfaceDocument
-
getDocumentURI
public String getDocumentURI()
- Specified by:
getDocumentURIin interfaceDocument
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean strictErrorChecking)
- Specified by:
setStrictErrorCheckingin interfaceDocument
-
getInputEncoding
public String getInputEncoding()
- Specified by:
getInputEncodingin interfaceDocument
-
getXmlEncoding
public String getXmlEncoding()
- Specified by:
getXmlEncodingin interfaceDocument
-
getXmlStandalone
public boolean getXmlStandalone()
- Specified by:
getXmlStandalonein interfaceDocument
-
setXmlStandalone
public void setXmlStandalone(boolean xmlStandalone) throws DOMException- Specified by:
setXmlStandalonein interfaceDocument- Throws:
DOMException
-
getXmlVersion
public String getXmlVersion()
- Specified by:
getXmlVersionin interfaceDocument
-
setXmlVersion
public void setXmlVersion(String xmlVersion) throws DOMException
- Specified by:
setXmlVersionin interfaceDocument- Throws:
DOMException
-
getStrictErrorChecking
public boolean getStrictErrorChecking()
- Specified by:
getStrictErrorCheckingin interfaceDocument
-
getBaseURI
public String getBaseURI()
- Specified by:
getBaseURIin interfaceNode
-
compareDocumentPosition
public short compareDocumentPosition(Node other) throws DOMException
- Specified by:
compareDocumentPositionin interfaceNode- Throws:
DOMException
-
getTextContent
public String getTextContent() throws DOMException
- Specified by:
getTextContentin interfaceNode- Throws:
DOMException
-
setTextContent
public void setTextContent(String textContent) throws DOMException
- Specified by:
setTextContentin interfaceNode- Throws:
DOMException
-
isSameNode
public boolean isSameNode(Node other)
- Specified by:
isSameNodein interfaceNode
-
lookupPrefix
public String lookupPrefix(String namespaceURI)
- Specified by:
lookupPrefixin interfaceNode
-
isDefaultNamespace
public boolean isDefaultNamespace(String namespaceURI)
- Specified by:
isDefaultNamespacein interfaceNode
-
lookupNamespaceURI
public String lookupNamespaceURI(String prefix)
- Specified by:
lookupNamespaceURIin interfaceNode
-
isEqualNode
public boolean isEqualNode(Node arg)
- Specified by:
isEqualNodein interfaceNode
-
getFeature
public Object getFeature(String feature, String version)
- Specified by:
getFeaturein interfaceNode
-
setUserData
public Object setUserData(String key, Object data, UserDataHandler handler)
- Specified by:
setUserDatain interfaceNode
-
getUserData
public Object getUserData(String key)
- Specified by:
getUserDatain interfaceNode
-
recycleNode
public void recycleNode()
Description copied from interface:NodeNotifies the implementation that thisNodeobject is no longer being used by the application and that the implementation is free to reuse this object for nodes that may be created later.Calling the method
recycleNodeimplies that the methoddetachNodehas been called previously.- Specified by:
recycleNodein interfaceNode
-
getValue
public String getValue()
Description copied from interface:NodeReturns the value of this node if this is aTextnode or the value of the immediate child of this node otherwise. If there is an immediate child of thisNodethat it is aTextnode then it's value will be returned. If there is more than oneTextnode then the value of the firstTextNode will be returned. Otherwisenullis returned.
-
setValue
public void setValue(String value)
Description copied from interface:NodeIf this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) child of this node. The value of the immediate child of this node can be set only if, there is one child node and that node is aTextnode, or if there are no children in which case a childTextnode will be created.
-
setParentElement
public void setParentElement(SOAPElement parent) throws SOAPException
Description copied from interface:NodeSets the parent of thisNodeobject to the givenSOAPElementobject.- Specified by:
setParentElementin interfaceNode- Parameters:
parent- theSOAPElementobject to be set as the parent of thisNodeobject- Throws:
SOAPException- if there is a problem in setting the parent to the given element- See Also:
Node.getParentElement()
-
getParentElement
public SOAPElement getParentElement()
Description copied from interface:NodeReturns the parent element of thisNodeobject. This method can throw anUnsupportedOperationExceptionif the tree is not kept in memory.- Specified by:
getParentElementin interfaceNode- Returns:
- the
SOAPElementobject that is the parent of thisNodeobject ornullif thisNodeobject is root - See Also:
Node.setParentElement(jakarta.xml.soap.SOAPElement)
-
detachNode
public void detachNode()
Description copied from interface:NodeRemoves thisNodeobject from the tree.- Specified by:
detachNodein interfaceNode
-
getSourceCharsetEncoding
public String getSourceCharsetEncoding()
-
getSOAPNamespace
public abstract String getSOAPNamespace()
-
-