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 da...@apache.org on 2008/08/11 21:50:25 UTC

svn commit: r684894 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java

Author: damrhei
Date: Mon Aug 11 12:50:25 2008
New Revision: 684894

URL: http://svn.apache.org/viewvc?rev=684894&view=rev
Log:
This fix will provide a method that Axis2 consumers may call in order to have the 'detach' logic called on the DetachableInputStream that may exist on a response MessageContext.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?rev=684894&r1=684893&r2=684894&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Mon Aug 11 12:50:25 2008
@@ -565,4 +565,33 @@
                log.debug("Exiting deleteAttachments()");
            }
        }
+       
+       /**
+        * This method can be called by components wishing to detach the DetachableInputStream
+        * object that is present on the MessageContext. This is meant to shield components
+        * from any logic that needs to be executed on the DetachableInputStream in order to 
+        * have it effectively detached. If the DetachableInputStream is not present, or if
+        * the supplied MessageContext is null, no action will be taken.
+        */
+       public static void detachInputStream(MessageContext msgContext) throws AxisFault {
+           try {
+               if(msgContext != null
+                       &&
+                       msgContext.getProperty(Constants.DETACHABLE_INPUT_STREAM) != null) {
+                   DetachableInputStream dis = (DetachableInputStream) msgContext.getProperty(Constants.DETACHABLE_INPUT_STREAM);
+                   if(log.isDebugEnabled()) {
+                       log.debug("Detaching DetachableInputStream: " + dis);
+                   }
+                   dis.detach();
+               }
+               else {
+                   if(log.isDebugEnabled()) {
+                       log.debug("Detach not performed for MessageContext: " + msgContext);
+                   }
+               }  
+           }
+           catch(Throwable t) {
+               throw AxisFault.makeFault(t);
+           }
+       }
 }