Class SaajStaxWriterEx
- java.lang.Object
-
- com.sun.xml.messaging.saaj.util.stax.SaajStaxWriter
-
- com.sun.xml.messaging.saaj.util.stax.SaajStaxWriterEx
-
- All Implemented Interfaces:
XMLStreamWriter,MtomStreamWriter,XMLStreamWriterEx
public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterEx, MtomStreamWriter
SaajStaxWriterEx converts XMLStreamWriterEx calls to build an orasaaj SOAPMessage with BinaryTextImpl.- Author:
- shih-chang.chen@oracle.com
-
-
Field Summary
Fields Modifier and Type Field Description protected static Stringhrefprotected static StringIncludeprotected static StringxopNS-
Fields inherited from class com.sun.xml.messaging.saaj.util.stax.SaajStaxWriter
Body, currentElement, deferredElement, Envelope, envURI, Header, soap, xmlns
-
-
Constructor Summary
Constructors Constructor Description SaajStaxWriterEx(javax.xml.soap.SOAPMessage msg, String uri)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.bind.attachment.AttachmentMarshallergetAttachmentMarshaller()NamespaceContextExgetNamespaceContext()voidwriteAttribute(String prefix, String ns, String ln, String value)voidwriteBinary(byte[] data, int offset, int length, String contentType)Write the binary data.OutputStreamwriteBinary(String arg0)Writes the binary data.voidwriteBinary(javax.activation.DataHandler data)Writes the binary data.voidwriteEndElement()voidwritePCDATA(CharSequence arg0)Writes likeXMLStreamWriter.writeCharacters(String)but hides actual data format.voidwriteStartElement(String prefix, String ln, String ns)-
Methods inherited from class com.sun.xml.messaging.saaj.util.stax.SaajStaxWriter
close, flush, getEnvelope, getPrefix, getProperty, getSOAPMessage, setDefaultNamespace, setNamespaceContext, setPrefix, writeAttribute, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDefaultNamespace, writeDTD, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndDocument, writeEntityRef, writeNamespace, writeProcessingInstruction, writeProcessingInstruction, writeStartDocument, writeStartDocument, writeStartDocument, writeStartElement, writeStartElement
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.xml.stream.XMLStreamWriter
close, flush, getPrefix, getProperty, setDefaultNamespace, setNamespaceContext, setPrefix, writeAttribute, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDefaultNamespace, writeDTD, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndDocument, writeEntityRef, writeNamespace, writeProcessingInstruction, writeProcessingInstruction, writeStartDocument, writeStartDocument, writeStartDocument, writeStartElement, writeStartElement
-
-
-
-
Field Detail
-
xopNS
protected static final String xopNS
- See Also:
- Constant Field Values
-
Include
protected static final String Include
- See Also:
- Constant Field Values
-
href
protected static final String href
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SaajStaxWriterEx
public SaajStaxWriterEx(javax.xml.soap.SOAPMessage msg, String uri) throws javax.xml.soap.SOAPException- Throws:
javax.xml.soap.SOAPException
-
-
Method Detail
-
writeStartElement
public void writeStartElement(String prefix, String ln, String ns) throws XMLStreamException
- Specified by:
writeStartElementin interfaceXMLStreamWriter- Overrides:
writeStartElementin classSaajStaxWriter- Throws:
XMLStreamException
-
writeEndElement
public void writeEndElement() throws XMLStreamException- Specified by:
writeEndElementin interfaceXMLStreamWriter- Overrides:
writeEndElementin classSaajStaxWriter- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String prefix, String ns, String ln, String value) throws XMLStreamException
- Specified by:
writeAttributein interfaceXMLStreamWriter- Overrides:
writeAttributein classSaajStaxWriter- Throws:
XMLStreamException
-
getNamespaceContext
public NamespaceContextEx getNamespaceContext()
Description copied from interface:XMLStreamWriterEx- Specified by:
getNamespaceContextin interfaceXMLStreamWriter- Specified by:
getNamespaceContextin interfaceXMLStreamWriterEx- Overrides:
getNamespaceContextin classSaajStaxWriter
-
writeBinary
public void writeBinary(javax.activation.DataHandler data) throws XMLStreamExceptionDescription copied from interface:XMLStreamWriterExWrites the binary data.This method works like the
XMLStreamWriterEx.writeBinary(byte[], int, int, String)method, except that it takes the binary data in the form ofDataHandler, which contains a MIME type (DataHandler.getContentType()as well as the payloadDataHandler.getInputStream().- Specified by:
writeBinaryin interfaceXMLStreamWriterEx- Parameters:
data- always non-null. After this method call, the callee owns the data handler.- Throws:
XMLStreamException
-
writeBinary
public OutputStream writeBinary(String arg0) throws XMLStreamException
Description copied from interface:XMLStreamWriterExWrites the binary data.This version of the writeBinary method allows the caller to produce the binary data by writing it to
OutputStream.It is the caller's responsibility to write and close a stream before it invokes any other methods on
XMLStreamWriter. TODO: experimental. appreciate feedback- Specified by:
writeBinaryin interfaceXMLStreamWriterEx- Parameters:
arg0- See the content-type parameter ofXMLStreamWriterEx.writeBinary(byte[], int, int, String). Must not be null.- Returns:
- always return a non-null
OutputStream. - Throws:
XMLStreamException
-
writeBinary
public void writeBinary(byte[] data, int offset, int length, String contentType) throws XMLStreamExceptionDescription copied from interface:XMLStreamWriterExWrite the binary data.Conceptually (infoset-wise), this produces the base64-encoded binary data on the output. But this allows implementations like FastInfoset or XOP to do the smart thing.
The use of this method has some restriction to support XOP. Namely, this method must be invoked as a sole content of an element.
(data,start,len) triplet identifies the binary data to be written. After the method invocation, the callee owns the buffer.
- Specified by:
writeBinaryin interfaceXMLStreamWriterExcontentType- this mandatory parameter identifies the MIME type of the binary data. If the MIME type isn't known by the caller, "application/octet-stream" can be always used to indicate "I don't know." Never null.- Throws:
XMLStreamException
-
writePCDATA
public void writePCDATA(CharSequence arg0) throws XMLStreamException
Description copied from interface:XMLStreamWriterExWrites likeXMLStreamWriter.writeCharacters(String)but hides actual data format.- Specified by:
writePCDATAin interfaceXMLStreamWriterEx- Parameters:
arg0- TheCharSequencethat represents the character infoset items to be written.The
CharSequenceis normally aString, but can be any otherCharSequenceimplementation. For binary data, however, use ofBase64Datais recommended (so that the consumer interested in seeing it as binary data may take advantage of mor efficient data representation.)- Throws:
XMLStreamException
-
getAttachmentMarshaller
public javax.xml.bind.attachment.AttachmentMarshaller getAttachmentMarshaller()
- Specified by:
getAttachmentMarshallerin interfaceMtomStreamWriter
-
-