[jbossws-commits] JBossWS SVN: r1299 - in branches/jbossws-1.0/src/main/java/org/jboss/ws: soap xop

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Tue Oct 24 11:19:53 EDT 2006


Author: heiko.braun at jboss.com
Date: 2006-10-24 11:19:51 -0400 (Tue, 24 Oct 2006)
New Revision: 1299

Modified:
   branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/JBossXBContentAdapter.java
Log:
clean up MTOM transitions

Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPContentElement.java	2006-10-24 15:11:22 UTC (rev 1298)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/soap/SOAPContentElement.java	2006-10-24 15:19:51 UTC (rev 1299)
@@ -972,29 +972,29 @@
     */
    public void handleMTOMTransitions()
    {
+      // MTOM processing is only required on XOP parameters
+      if( isXOPParameter() == false)
+         return;
 
-      boolean mtomEnabled = isXOPParameter() && XOPContext.isMTOMEnabled();
-
-      if (paramMetaData != null && mtomEnabled == false)
+      if ( !XOPContext.isMTOMEnabled() )
       {
-         // If MTOM is disabled, we force dom expansion.
-         // This will inline any XOP include element
-         // and remove the attachment part when transitioning.
+         // If MTOM is disabled, we force dom expansion on XOP parameters.
+         // This will inline any XOP include element and remove the attachment part.
          // See SOAPFactoryImpl for details.
 
-         log.debug("MTOM disabled: Enforce dom-valid state");
+         log.debug("MTOM disabled: Force inline XOP data");
          CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
          msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
          expandToDOM();
       }
-      else if (isDOMValid && mtomEnabled)
+      else if ( isDOMValid && XOPContext.isMTOMEnabled() )
       {
          // When the DOM representation is valid,
          // but MTOM is enabled we need to convert the inlined
          // element back to an xop:Include element and create the attachment part
 
          log.debug("MTOM enabled: Restore XOP data");
-         XOPContext.restoreXOPDataDOM(this);        
+         XOPContext.restoreXOPDataDOM(this);
       }
    }
 

Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/JBossXBContentAdapter.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/JBossXBContentAdapter.java	2006-10-24 15:11:22 UTC (rev 1298)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/JBossXBContentAdapter.java	2006-10-24 15:19:51 UTC (rev 1299)
@@ -105,6 +105,11 @@
       // may be null when it's actually an encoded request ?!
       Class targetClass = ctx.resolvePropertyType();
 
+      if(null==targetClass) {
+         log.warn("Failed to resolve target property on " + ctx.getParticle());
+         log.debug("Parent particle is " + ctx.getParentParticle());
+      }
+
       boolean isRegularMessage = !XOPContext.isXOPMessage();
       boolean isSimpleType = (object instanceof byte[]);
       boolean doTypesMatch = (targetClass!=null && targetClass.equals(object.getClass()));
@@ -144,7 +149,11 @@
          try
          {
             DataHandler attachmentHandle = (DataHandler)object;
-            if(!attachmentHandle.getContentType().equals("application/octet-stream"))
+            String contentType = attachmentHandle.getContentType();
+            log.debug("Adopt DataHandler to " + targetClass +", contentType "+ contentType);
+
+            // TODO: fix me as soon as targetClass info is available
+            if(!contentType.equals("application/octet-stream"))
             {
                DataHandler dh = new DataHandler(attachmentHandle.getDataSource());
                object = dh.getContent();




More information about the jbossws-commits mailing list