You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by th...@apache.org on 2007/02/20 10:07:25 UTC
svn commit: r509475 -
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
Author: thilina
Date: Tue Feb 20 01:07:24 2007
New Revision: 509475
URL: http://svn.apache.org/viewvc?view=rev&rev=509475
Log:
Adding attachment removing method to the MessageContext +more comments
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java?view=diff&rev=509475&r1=509474&r2=509475
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java Tue Feb 20 01:07:24 2007
@@ -1570,37 +1570,80 @@
this.attachments = attachments;
}
- public Attachments getAttachmentMap() {
- if (attachments == null) {
- attachments = new Attachments();
- }
- return attachments;
- }
+ /**
+ * You can directly access the attachment map of the message context from
+ * here. Returned attachment map can be empty.
+ *
+ * @return attachment
+ */
+ public Attachments getAttachmentMap() {
+ if (attachments == null) {
+ attachments = new Attachments();
+ }
+ return attachments;
+ }
- public void addAttachment(String contentID, DataHandler dataHandler) {
- if (attachments == null) {
- attachments = new Attachments();
- }
- attachments.addDataHandler(contentID, dataHandler);
- }
+ /**
+ * Adds an attachment to the attachment Map of this message context. This
+ * attachment gets serialised as a MIME attachment when sending the message
+ * if SOAP with Attachments is enabled.
+ *
+ * @param contentID :
+ * will be the content ID of the MIME part
+ * @param dataHandler
+ */
+ public void addAttachment(String contentID, DataHandler dataHandler) {
+ if (attachments == null) {
+ attachments = new Attachments();
+ }
+ attachments.addDataHandler(contentID, dataHandler);
+ }
+ /**
+ * Adds an attachment to the attachment Map of this message context. This
+ * attachment gets serialised as a MIME attachment when sending the message
+ * if SOAP with Attachments is enabled. Content ID of the MIME part will be
+ * auto generated by Axis2.
+ *
+ * @param dataHandler
+ * @return the auto generated content ID of the MIME attachment
+ */
public String addAttachment(DataHandler dataHandler) {
- String contentID = UUIDGenerator.getUUID();
- addAttachment(contentID, dataHandler);
- return contentID;
- }
+ String contentID = UUIDGenerator.getUUID();
+ addAttachment(contentID, dataHandler);
+ return contentID;
+ }
+
+ /**
+ * Access the DataHandler of the attachment contained in the map corresponding to the given
+ * content ID. Returns "NULL" if a attachment cannot be found by the given content ID.
+ * @param contentID :
+ * Content ID of the MIME attachment
+ * @return Data handler of the attachment
+ */
+ public DataHandler getAttachment(String contentID) {
+ if (attachments == null) {
+ attachments = new Attachments();
+ }
+ return attachments.getDataHandler(contentID);
+ }
- public DataHandler getAttachment(String contentID) {
- if (attachments == null) {
- attachments = new Attachments();
- }
- return attachments.getDataHandler(contentID);
+ /**
+ * Removes the attachment with the given content ID from the Attachments Map
+ * Do nothing if a attachment cannot be found by the given content ID.
+ * @param contentID of the attachment
+ */
+ public void removeAttachment(String contentID) {
+ if (attachments != null) {
+ attachments.removeDataHandler(contentID);
+ }
}
- /* ===============================================================
- * SelfManagedData Section
- * ===============================================================
- */
+ /*
+ * ===============================================================
+ * SelfManagedData Section
+ * ===============================================================
+ */
/*
* character to delimit strings
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org