|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
An interface representing a multipart message. This is a subinterface of
Message which contains methods to add and get MessageParts.
The interface also allows to specify the subject of the message. The basic
methods for manipulating the address portion of the message are inherited
from Message. Additional this interface defines methods for
adding and removing addresses to/from the "to", "cc" or "bcc" fields.
Furthermore it offers methods to get and set special header fields of the
message. The contents of the MultipartMessage are assembled during the
invocation of the MessageConnection.send() method. The contents of each
MessagePart are copied before the send message returns. Changes to the
MessagePart contents after send must not appear in the transmitted message.
| Method Summary | |
boolean |
addAddress(java.lang.String type,
java.lang.String address)
Adds an address to the multipart message. |
void |
addMessagePart(MessagePart part)
Attaches a MessagePart to the multipart message |
java.lang.String |
getAddress()
Returns the "from" address associated with this message, e.g. address of the sender. |
java.lang.String[] |
getAddresses(java.lang.String type)
Gets the addresses of the multipart message of the specified type. |
java.lang.String |
getHeader(java.lang.String headerField)
Gets the content of the specific header field of the multipart message. |
MessagePart |
getMessagePart(java.lang.String contentID)
This method returns a MessagePart from the message that
matches the content-id passed as a parameter |
MessagePart[] |
getMessageParts()
Returns an array of all MessageParts of this message |
java.lang.String |
getStartContentId()
Returns the contentId of the start MessagePart.
|
java.lang.String |
getSubject()
Gets the subject of the multipart message. |
boolean |
removeAddress(java.lang.String type,
java.lang.String address)
Removes an address from the multipart message. |
void |
removeAddresses()
Removes all addresses of types "to", "cc", and bcc" from the multipart message. |
void |
removeAddresses(java.lang.String type)
Removes all addresses of the specified type from the multipart message. |
boolean |
removeMessagePart(MessagePart part)
Removes a MessagePart from the multipart message |
boolean |
removeMessagePartId(java.lang.String contentID)
Removes a MessagePart with the specific contentID
from the multipart message |
boolean |
removeMessagePartLocation(java.lang.String contentLocation)
Removes MessagePart s with the specific content location
from the multipart message. |
void |
setAddress(java.lang.String addr)
Sets the "to" address associated with this message. |
void |
setHeader(java.lang.String headerField,
java.lang.String headerValue)
Sets the specific header of the multipart message. |
void |
setStartContentId(java.lang.String contentId)
Sets the Content-ID of the start MessagePart
of a multipart related message. |
void |
setSubject(java.lang.String subject)
Sets the Subject of the multipart message. |
| Methods inherited from interface javax.wireless.messaging.Message |
getTimestamp |
| Method Detail |
public void addMessagePart(MessagePart part)
throws SizeExceededException
MessagePart to the multipart message
part - MessagePart to add
java.lang.IllegalArgumentException - if the Content-ID of the MessagePart
conflicts with a Content-ID of an MessagePart
already contained in this MultipartMessage.
The Content-IDs must be unique within a MultipartMessage.
java.lang.NullPointerException - if the parameter is null
SizeExceededException - if it's not possible to attach the MessagePart.public boolean removeMessagePartId(java.lang.String contentID)
MessagePart with the specific contentID
from the multipart message
contentID - identifiers which MessagePart must be deleted.
true, if it was possible to remove the MessagePart,
else false
java.lang.NullPointerException - if the parameter is nullpublic boolean removeMessagePart(MessagePart part)
MessagePart from the multipart message
part - MessagePart to delete
true, if it was possible to remove the MessagePart,
else false
java.lang.NullPointerException - if the parameter is nullpublic boolean removeMessagePartLocation(java.lang.String contentLocation)
MessagePart s with the specific content location
from the multipart message. All MessageParts with the
specified contentLocation are removed
contentLocation - content location (file name) of the MessagePart
true, if it was possible to remove the MessagePart,
else false
java.lang.NullPointerException - if the parameter is nullpublic MessagePart getMessagePart(java.lang.String contentID)
MessagePart from the message that
matches the content-id passed as a parameter
contentID - the content-id for the MessagePart to be
returned
MessagePart that matches the provided content-id
or null if there is no MessagePart
in this message with the provided content-id
java.lang.NullPointerException - if the parameter is nullpublic java.lang.String getStartContentId()
contentId of the start MessagePart.
The start MessagePart is set in setStartContentId(String)
MessagePart or null
if the start MessagePart is not set.setStartContentId(String)public MessagePart[] getMessageParts()
MessageParts of this message
MessageParts, or null,
if no MessageParts are availablepublic void setStartContentId(java.lang.String contentId)
Content-ID of the start MessagePart
of a multipart related message. The Content-ID may be set
to null. The StartContentId is set for
the MessagePart that is used to reference the other MessageParts of the
MultipartMessage for presentation or processing purposes.
contentId - as a String
java.lang.IllegalArgumentException - if contentId is none of the added MessageParts
objects matches the contentIdgetStartContentId()public java.lang.String getSubject()
String or null
if this value is not present.public java.lang.String getHeader(java.lang.String headerField)
headerField - the name of the header field as a String
String
or null if the specified header field is not
present.
java.lang.SecurityException - if the access to specified header field is restricted
java.lang.IllegalArgumentException - if headerField is unknownpublic void setSubject(java.lang.String subject)
null.
subject - the message subject as a StringgetSubject()public void setHeader(java.lang.String headerField,
java.lang.String headerValue)
null.
headerField - the name of the header field as a StringheaderValue - the value of the header as a String
java.lang.IllegalArgumentException - if headerField is unknown, or if headerValue
is not correct (depends on headerField!)
java.lang.NullPointerException - if headerField is null
java.lang.SecurityException - if the access to specified header field is restrictedgetHeader(String),
"Appendix D"public boolean addAddress(java.lang.String type,
java.lang.String address)
type - the address type ("to", "cc" or "bcc") as a String.
Each message can have none or multiple "to", "cc" and "bcc"
addresses. Each address is added separately. The type is not
case sensitive. The implementation of MessageConnection.send()
makes sure that the "from" address is set correctly.address - the address as a String
true if it was possible to add the address, else
false
java.lang.IllegalArgumentException - if type is none of "to", "cc", or "bcc" or if address
is not valid.setAddress(String address)public void removeAddresses()
setAddress(String),
addAddress(String, String)public void removeAddresses(java.lang.String type)
type - the address type ("to", "cc", or "bcc") as a String.
java.lang.NullPointerException - if type is null
java.lang.IllegalArgumentException - if type is none of "to", "cc", or "bcc"public boolean removeAddress(java.lang.String type,
java.lang.String address)
type - the address type ("to", "cc", or "bcc") as a String.address - the address as a String
true if it was possible to delete the address,
else false
java.lang.NullPointerException - if type is null
java.lang.IllegalArgumentException - if type is none of "to", "cc", or "bcc"public java.lang.String[] getAddresses(java.lang.String type)
String. The method is
not case sensitive.
String array or null
if the address of the specified type is not present.public java.lang.String getAddress()
Returns null, if the "from" or "to" addresses for the
message, dependent on the case, are not set.
Note: This design allows sending responses to a received message easily
by reusing the same Message object and just replacing the
payload. The address field can normally be kept untouched (unless the
used messaging protocol requires some special handling of the address).
getAddress in interface Messagenull
if the address that is expected as a result of the method is not
setsetAddress(String)public void setAddress(java.lang.String addr)
null.
setAddress in interface Messageaddr - address for the message
java.lang.IllegalArgumentException - if address is not valid.getAddress(),
addAddress(String, String)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||