com.sun.xml.messaging.saaj.soap
Class MessageImpl

java.lang.Object
  extended by javax.xml.soap.SOAPMessage
      extended by com.sun.xml.messaging.saaj.soap.MessageImpl
All Implemented Interfaces:
javax.xml.soap.SOAPConstants
Direct Known Subclasses:
Message1_1Impl, Message1_2Impl

public abstract class MessageImpl
extends javax.xml.soap.SOAPMessage
implements javax.xml.soap.SOAPConstants

The message implementation for SOAP messages with attachments. Messages for specific profiles will likely extend this MessageImpl class and add more value for that particular profile.

Author:
Anil Vijendran (akv@eng.sun.com), Rajiv Mordani (rajiv.mordani@sun.com), Manveen Kaur (manveen.kaur@sun.com)

Field Summary
protected  boolean acceptFastInfoset
          True if the Accept header of this message includes application/fastinfoset
protected  FinalArrayList attachments
           
protected  boolean attachmentsInitialized
           
static java.lang.String CONTENT_ID
           
static java.lang.String CONTENT_LOCATION
           
protected static int FI_ENCODED_FLAG
           
protected  javax.xml.soap.MimeHeaders headers
           
protected  boolean isFastInfoset
          True if this part is encoded using Fast Infoset.
protected static java.util.logging.Logger log
           
protected  int messageByteCount
           
protected  byte[] messageBytes
           
protected static int MIME_MULTIPART_FLAG
           
protected static int MIME_MULTIPART_XOP_FLAG
           
protected  MimeMultipart mmp
           
protected  MimeMultipart multiPart
           
protected static int PLAIN_XML_FLAG
           
protected  java.util.HashMap properties
           
protected  boolean saved
           
protected static int SOAP1_1_FLAG
           
protected static int SOAP1_2_FLAG
           
protected  SOAPPartImpl soapPart
           
protected static int XOP_FLAG
           
 
Fields inherited from class javax.xml.soap.SOAPMessage
CHARACTER_SET_ENCODING, WRITE_XML_DECLARATION
 
Fields inherited from interface javax.xml.soap.SOAPConstants
DEFAULT_SOAP_PROTOCOL, DYNAMIC_SOAP_PROTOCOL, SOAP_1_1_CONTENT_TYPE, SOAP_1_1_PROTOCOL, SOAP_1_2_CONTENT_TYPE, SOAP_1_2_PROTOCOL, SOAP_DATAENCODINGUNKNOWN_FAULT, SOAP_ENV_PREFIX, SOAP_MUSTUNDERSTAND_FAULT, SOAP_RECEIVER_FAULT, SOAP_SENDER_FAULT, SOAP_VERSIONMISMATCH_FAULT, URI_NS_SOAP_1_1_ENVELOPE, URI_NS_SOAP_1_2_ENCODING, URI_NS_SOAP_1_2_ENVELOPE, URI_NS_SOAP_ENCODING, URI_NS_SOAP_ENVELOPE, URI_SOAP_1_2_ROLE_NEXT, URI_SOAP_1_2_ROLE_NONE, URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER, URI_SOAP_ACTOR_NEXT
 
Constructor Summary
protected MessageImpl()
          Construct a new message.
protected MessageImpl(boolean isFastInfoset, boolean acceptFastInfoset)
          Construct a new message.
protected MessageImpl(javax.xml.soap.MimeHeaders headers, ContentType contentType, int stat, java.io.InputStream in)
          Construct a message from an input stream.
protected MessageImpl(javax.xml.soap.MimeHeaders headers, java.io.InputStream in)
          Construct a message from an input stream.
protected MessageImpl(javax.xml.soap.SOAPMessage msg)
          Shallow copy.
 
Method Summary
 boolean acceptFastInfoset()
           
 void addAttachmentPart(javax.xml.soap.AttachmentPart attachment)
           
 int countAttachments()
           
 javax.xml.soap.AttachmentPart createAttachmentPart()
           
 java.lang.String getAction()
           
 javax.xml.soap.AttachmentPart getAttachment(javax.xml.soap.SOAPElement element)
           
 java.util.Iterator getAttachments()
           
 java.util.Iterator getAttachments(javax.xml.soap.MimeHeaders headers)
           
 java.lang.String getBaseType()
           
 java.lang.String getCharset()
           
 java.lang.String getContentDescription()
           
 java.lang.String getContentType()
           
protected abstract  java.lang.String getExpectedAcceptHeader()
           
protected abstract  java.lang.String getExpectedContentType()
           
 javax.xml.soap.MimeHeaders getMimeHeaders()
           
 java.lang.Object getProperty(java.lang.String property)
           
 javax.xml.soap.SOAPBody getSOAPBody()
           
 javax.xml.soap.SOAPHeader getSOAPHeader()
           
abstract  javax.xml.soap.SOAPPart getSOAPPart()
           
protected abstract  boolean isCorrectSoapVersion(int contentTypeId)
           
 boolean isFastInfoset()
           
protected static boolean isSoap1_1Content(int stat)
           
protected static boolean isSoap1_2Content(int stat)
           
 void removeAllAttachments()
           
 void removeAttachments(javax.xml.soap.MimeHeaders headers)
           
 void saveChanges()
           
 boolean saveRequired()
           
 void setAction(java.lang.String action)
           
 void setBaseType(java.lang.String type)
           
 void setCharset(java.lang.String charset)
           
 void setContentDescription(java.lang.String description)
           
 void setContentType(java.lang.String type)
           
 void setIsFastInfoset(boolean value)
           
 void setLazyAttachments(boolean flag)
           
 void setProperty(java.lang.String property, java.lang.Object value)
           
 void writeTo(java.io.OutputStream out)
           
 
Methods inherited from class javax.xml.soap.SOAPMessage
createAttachmentPart, createAttachmentPart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_ID

public static final java.lang.String CONTENT_ID
See Also:
Constant Field Values

CONTENT_LOCATION

public static final java.lang.String CONTENT_LOCATION
See Also:
Constant Field Values

log

protected static java.util.logging.Logger log

PLAIN_XML_FLAG

protected static final int PLAIN_XML_FLAG
See Also:
Constant Field Values

MIME_MULTIPART_FLAG

protected static final int MIME_MULTIPART_FLAG
See Also:
Constant Field Values

SOAP1_1_FLAG

protected static final int SOAP1_1_FLAG
See Also:
Constant Field Values

SOAP1_2_FLAG

protected static final int SOAP1_2_FLAG
See Also:
Constant Field Values

MIME_MULTIPART_XOP_FLAG

protected static final int MIME_MULTIPART_XOP_FLAG
See Also:
Constant Field Values

XOP_FLAG

protected static final int XOP_FLAG
See Also:
Constant Field Values

FI_ENCODED_FLAG

protected static final int FI_ENCODED_FLAG
See Also:
Constant Field Values

headers

protected javax.xml.soap.MimeHeaders headers

soapPart

protected SOAPPartImpl soapPart

attachments

protected FinalArrayList attachments

saved

protected boolean saved

messageBytes

protected byte[] messageBytes

messageByteCount

protected int messageByteCount

properties

protected java.util.HashMap properties

multiPart

protected MimeMultipart multiPart

attachmentsInitialized

protected boolean attachmentsInitialized

isFastInfoset

protected boolean isFastInfoset
True if this part is encoded using Fast Infoset. MIME -> application/fastinfoset


acceptFastInfoset

protected boolean acceptFastInfoset
True if the Accept header of this message includes application/fastinfoset


mmp

protected MimeMultipart mmp
Constructor Detail

MessageImpl

protected MessageImpl()
Construct a new message. This will be invoked before message sends.


MessageImpl

protected MessageImpl(boolean isFastInfoset,
                      boolean acceptFastInfoset)
Construct a new message. This will be invoked before message sends.


MessageImpl

protected MessageImpl(javax.xml.soap.SOAPMessage msg)
Shallow copy.


MessageImpl

protected MessageImpl(javax.xml.soap.MimeHeaders headers,
                      java.io.InputStream in)
               throws SOAPExceptionImpl
Construct a message from an input stream. When messages are received, there's two parts -- the transport headers and the message content in a transport specific stream.

Throws:
SOAPExceptionImpl

MessageImpl

protected MessageImpl(javax.xml.soap.MimeHeaders headers,
                      ContentType contentType,
                      int stat,
                      java.io.InputStream in)
               throws SOAPExceptionImpl
Construct a message from an input stream. When messages are received, there's two parts -- the transport headers and the message content in a transport specific stream.

Parameters:
contentType - The parsed content type header from the headers variable. This is redundant parameter, but it avoids reparsing this header again.
stat - The result of identifyContentType(ContentType) over the contentType parameter. This redundant parameter, but it avoids recomputing this information again.
Throws:
SOAPExceptionImpl
Method Detail

isSoap1_1Content

protected static boolean isSoap1_1Content(int stat)
Parameters:
stat - the mask value obtained from identifyContentType(ContentType)

isSoap1_2Content

protected static boolean isSoap1_2Content(int stat)
Parameters:
stat - the mask value obtained from identifyContentType(ContentType)

isFastInfoset

public boolean isFastInfoset()

acceptFastInfoset

public boolean acceptFastInfoset()

setIsFastInfoset

public void setIsFastInfoset(boolean value)

getProperty

public java.lang.Object getProperty(java.lang.String property)
Overrides:
getProperty in class javax.xml.soap.SOAPMessage

setProperty

public void setProperty(java.lang.String property,
                        java.lang.Object value)
Overrides:
setProperty in class javax.xml.soap.SOAPMessage

isCorrectSoapVersion

protected abstract boolean isCorrectSoapVersion(int contentTypeId)

getExpectedContentType

protected abstract java.lang.String getExpectedContentType()

getExpectedAcceptHeader

protected abstract java.lang.String getExpectedAcceptHeader()

getMimeHeaders

public javax.xml.soap.MimeHeaders getMimeHeaders()
Specified by:
getMimeHeaders in class javax.xml.soap.SOAPMessage

getContentType

public java.lang.String getContentType()

setContentType

public void setContentType(java.lang.String type)

getBaseType

public java.lang.String getBaseType()

setBaseType

public void setBaseType(java.lang.String type)

getAction

public java.lang.String getAction()

setAction

public void setAction(java.lang.String action)

getCharset

public java.lang.String getCharset()

setCharset

public void setCharset(java.lang.String charset)

saveRequired

public boolean saveRequired()
Specified by:
saveRequired in class javax.xml.soap.SOAPMessage

getContentDescription

public java.lang.String getContentDescription()
Specified by:
getContentDescription in class javax.xml.soap.SOAPMessage

setContentDescription

public void setContentDescription(java.lang.String description)
Specified by:
setContentDescription in class javax.xml.soap.SOAPMessage

getSOAPPart

public abstract javax.xml.soap.SOAPPart getSOAPPart()
Specified by:
getSOAPPart in class javax.xml.soap.SOAPMessage

removeAllAttachments

public void removeAllAttachments()
Specified by:
removeAllAttachments in class javax.xml.soap.SOAPMessage

countAttachments

public int countAttachments()
Specified by:
countAttachments in class javax.xml.soap.SOAPMessage

addAttachmentPart

public void addAttachmentPart(javax.xml.soap.AttachmentPart attachment)
Specified by:
addAttachmentPart in class javax.xml.soap.SOAPMessage

getAttachments

public java.util.Iterator getAttachments()
Specified by:
getAttachments in class javax.xml.soap.SOAPMessage

getAttachments

public java.util.Iterator getAttachments(javax.xml.soap.MimeHeaders headers)
Specified by:
getAttachments in class javax.xml.soap.SOAPMessage

removeAttachments

public void removeAttachments(javax.xml.soap.MimeHeaders headers)
Specified by:
removeAttachments in class javax.xml.soap.SOAPMessage

createAttachmentPart

public javax.xml.soap.AttachmentPart createAttachmentPart()
Specified by:
createAttachmentPart in class javax.xml.soap.SOAPMessage

getAttachment

public javax.xml.soap.AttachmentPart getAttachment(javax.xml.soap.SOAPElement element)
                                            throws javax.xml.soap.SOAPException
Specified by:
getAttachment in class javax.xml.soap.SOAPMessage
Throws:
javax.xml.soap.SOAPException

saveChanges

public void saveChanges()
                 throws javax.xml.soap.SOAPException
Specified by:
saveChanges in class javax.xml.soap.SOAPMessage
Throws:
javax.xml.soap.SOAPException

writeTo

public void writeTo(java.io.OutputStream out)
             throws javax.xml.soap.SOAPException,
                    java.io.IOException
Specified by:
writeTo in class javax.xml.soap.SOAPMessage
Throws:
javax.xml.soap.SOAPException
java.io.IOException

getSOAPBody

public javax.xml.soap.SOAPBody getSOAPBody()
                                    throws javax.xml.soap.SOAPException
Overrides:
getSOAPBody in class javax.xml.soap.SOAPMessage
Throws:
javax.xml.soap.SOAPException

getSOAPHeader

public javax.xml.soap.SOAPHeader getSOAPHeader()
                                        throws javax.xml.soap.SOAPException
Overrides:
getSOAPHeader in class javax.xml.soap.SOAPMessage
Throws:
javax.xml.soap.SOAPException

setLazyAttachments

public void setLazyAttachments(boolean flag)