|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface MultipartMessage
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. This interface defines additional methods for
adding and removing addresses to/from the "to", "cc" and "bcc" address lists. 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(Message) 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.
This interface is defined in JSR 205: Wireless Messaging API 2.0, which extends and enhances JSR 120: Wireless Messaging API
| Method Summary | ||
|---|---|---|
boolean |
addAddress(String type,
String address)
Adds an address to the multipart message. |
|
void |
addMessagePart(MessagePart part)
Attaches a MessagePart to the multipart message. |
|
String |
getAddress()
Returns the "from" address associated with this message. |
|
String[] |
getAddresses(String type)
Gets the addresses of the multipart message of the specified type. |
|
String |
getHeader(String headerField)
Gets the content of the specific header field of the multipart message. |
|
MessagePart |
getMessagePart(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 MessagePart objects of this message. |
|
String |
getStartContentId()
Returns the content ID of the start MessagePart. |
|
String |
getSubject()
Gets the subject of the multipart message. |
|
boolean |
removeAddress(String type,
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(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(String contentID)
Removes a MessagePart with the specific content ID from the multipart message. |
|
boolean |
removeMessagePartLocation(String contentLocation)
Removes MessageParts with the specific content location from the multipart
message. |
|
void |
setAddress(String addr)
Sets the "to" address associated with this message. |
|
void |
setHeader(String headerField,
String headerValue)
Sets the specific header of the multipart message. |
|
void |
setStartContentId(String contentId)
Sets the Content-ID of the start MessagePart of a multipart related message. |
|
void |
setSubject(String subject)
Sets the Subject of the multipart message. |
|
| Methods inherited from interface javax.wireless.messaging.Message |
|---|
getTimestamp |
| Method Detail |
|---|
boolean addAddress(String type,
String address)
type - the address type ("to", "cc" or "bcc") as a String. Each message can
have none or multiple "to", "cc" or "bcc" addresses. Each address is added separately. The
type is not case sensitive. The implementation of MessageConnection.send(Message)
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.
IllegalArgumentException - if type is none of "to", "cc" or "bcc" or if address is not
valid.MultipartMessage.setAddress(String),
MultipartMessage.getAddresses(String),
MultipartMessage.removeAddresses(),
MultipartMessage.removeAddress(String, String),
MultipartMessage.removeAddresses(String)
void addMessagePart(MessagePart part)
throws SizeExceededException
MessagePart to the multipart message.
part - MessagePart to add.
IllegalArgumentException - if the Content-ID of the MessagePart conflicts
with a Content-ID of a MessagePart already contained in this
MultipartMessage. The Content-IDs must be unique within a
MultipartMessage.
NullPointerException - if the parameter is null.
SizeExceededException - if it is not possible to attach the MessagePart.MultipartMessage.getMessageParts(),
MultipartMessage.getMessagePart(String),
MultipartMessage.removeMessagePart(MessagePart),
MultipartMessage.removeMessagePartId(String),
MultipartMessage.removeMessagePartLocation(String)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 set.MultipartMessage.setAddress(String)String[] getAddresses(String type)
String. The method is not case sensitive.
type - the address type ("to", "cc", "bcc", or "from") as a String. The
type is not case sensitive.
String array or null if the addresses of
the specified type is not present.MultipartMessage.addAddress(String, String)String getHeader(String headerField)
headerField - the name of the header field as a String.
String or
null if the specified header field is not present.
SecurityException - if the access to specified header field is restricted; See Appendix
D of the WMA 2.0 specification for accessible header fields.
IllegalArgumentException - if headerField is unknown.MultipartMessage.setHeader(String, String)MessagePart getMessagePart(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.
NullPointerException - if the parameter is null.MultipartMessage.getMessageParts(),
MultipartMessage.addMessagePart(MessagePart)MessagePart[] getMessageParts()
MessagePart objects of this message.
MessageParts, or null, if no
MessageParts are availableMultipartMessage.getMessagePart(String),
MultipartMessage.addMessagePart(MessagePart)String getStartContentId()
MessagePart. The start
MessagePart is set in setStartContentId(String).
MessagePart or null if the
start MessagePart is not set.MultipartMessage.setStartContentId(String)String getSubject()
String or null if this value is
not present.MultipartMessage.setSubject(String)
boolean removeAddress(String type,
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 remove the address, else false.
NullPointerException - if type is null.
IllegalArgumentException - if type is none of "to", "cc", or "bcc".MultipartMessage.addAddress(String, String),
MultipartMessage.setAddress(String),
MultipartMessage.removeAddresses(),
MultipartMessage.removeAddresses(String)void removeAddresses()
MultipartMessage.addAddress(String, String),
MultipartMessage.setAddress(String),
MultipartMessage.removeAddresses(String),
MultipartMessage.removeAddress(String, String)void removeAddresses(String type)
type - the address type ("to", "cc", or "bcc") as a String.
NullPointerException - if type is null
IllegalArgumentException - if type is none of "to", "cc", or "bcc".MultipartMessage.addAddress(String, String),
MultipartMessage.setAddress(String),
MultipartMessage.removeAddresses(),
MultipartMessage.removeAddress(String, String)boolean removeMessagePart(MessagePart part)
MessagePart from the multipart message.
part - MessagePart to remove.
true, if it was possible to remove the MessagePart, else
false.
NullPointerException - if the parameter is null.MultipartMessage.addMessagePart(MessagePart),
MultipartMessage.removeMessagePartId(String),
MultipartMessage.removeMessagePartLocation(String)boolean removeMessagePartId(String contentID)
MessagePart with the specific content ID from the multipart message.
contentID - identifiers which MessagePart must be removed.
true, if it was possible to remove the MessagePart, else
false.
NullPointerException - if the parameter is null.MultipartMessage.addMessagePart(MessagePart),
MultipartMessage.removeMessagePart(MessagePart),
MultipartMessage.removeMessagePartLocation(String)boolean removeMessagePartLocation(String contentLocation)
MessageParts with the specific content location from the multipart
message. All MessageParts with the specified contentLocation are
removed.
contentLocation - content location (file name) of the MessageParts to
remove.
true, if it was possible to remove the MessagePart, else
false.
NullPointerException - if the parameter is null.MultipartMessage.addMessagePart(MessagePart),
MultipartMessage.removeMessagePart(MessagePart),
MultipartMessage.removeMessagePartId(String)void setAddress(String addr)
addAddress("to", addr). The address may be set to null.
setAddress in interface Messageaddr - address for the message.
IllegalArgumentException - if address is not valid.MultipartMessage.getAddress(),
MultipartMessage.addAddress(String, String)
void setHeader(String headerField,
String headerValue)
null.
headerField - the name of the header field as a String.headerValue - the value of the header as a String.
IllegalArgumentException - if headerField is unknown, or if
headerValue is not correct (depends on headerField).
NullPointerException - if headerField is null.
SecurityException - if the access to specified header field is restricted; See Appendix
D of the WMA 2.0 specification for accessible header fields.MultipartMessage.getHeader(String)void setStartContentId(String contentId)
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 - the start Content ID to set as a String.
IllegalArgumentException - if contentId is none of the added
MessagePart objects matches the content ID.MultipartMessage.getStartContentId()void setSubject(String subject)
null.
subject - the message subject as a String.MultipartMessage.getSubject()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.