Author: richard.opalka(a)jboss.com
Date: 2009-04-07 05:20:26 -0400 (Tue, 07 Apr 2009)
New Revision: 9757
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
Log:
[JBWS-2561] specify mtom in descriptor
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2009-04-07
08:03:17 UTC (rev 9756)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2009-04-07
09:20:26 UTC (rev 9757)
@@ -35,6 +35,10 @@
import org.jboss.wsf.stack.cxf.metadata.services.DDBeans;
import org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.MTOM;
+
/**
* A deployer that locates or generates cxf.xml
*
@@ -163,8 +167,10 @@
String address = ep.getAddress();
String implementor = ep.getTargetBeanName();
- DDEndpoint ddep = new DDEndpoint(id, address, implementor);
+ boolean mtomEnabled = isMtomEnabled(ep.getTargetBeanClass());
+ DDEndpoint ddep = new DDEndpoint(id, address, implementor, mtomEnabled);
+
if (depType == DeploymentType.JAXWS_EJB3)
{
ddep.setInvoker(invokerEJB3);
@@ -175,6 +181,7 @@
ddep.setInvoker(invokerJSE);
}
+
log.info("Add " + ddep);
dd.addEndpoint(ddep);
}
@@ -207,4 +214,19 @@
contextParams.put(CXFServletExt.PARAM_CXF_BEANS_URL, cxfURL.toExternalForm());
}
+ private static boolean isMtomEnabled(Class<?> beanClass)
+ {
+ BindingType bindingType = (BindingType)beanClass.getAnnotation(BindingType.class);
+ MTOM mtom = (MTOM)beanClass.getAnnotation(MTOM.class);
+
+ boolean mtomEnabled = mtom != null;
+ if (!mtomEnabled && bindingType != null)
+ {
+ String binding = bindingType.value();
+ mtomEnabled = binding.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
binding.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
+ }
+
+ return mtomEnabled;
+ }
+
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java 2009-04-07
08:03:17 UTC (rev 9756)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDBeans.java 2009-04-07
09:20:26 UTC (rev 9757)
@@ -104,6 +104,7 @@
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
"xmlns:beans='http://www.springframework.org/schema/beans'
" +
"xmlns:jaxws='http://cxf.apache.org/jaxws' " +
+ "xmlns:soap='http://cxf.apache.org/bindings/soap' " +
"xsi:schemaLocation='http://www.springframework.org/schema/beans
" +
"http://www.springframework.org/schema/beans/spring-beans.xsd " +
"http://cxf.apache.org/jaxws " +
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2009-04-07
08:03:17 UTC (rev 9756)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2009-04-07
09:20:26 UTC (rev 9757)
@@ -28,7 +28,7 @@
* Metadata model for cxf.xml
*
* @author Thomas.Diesler(a)jboss.org
- * @since 21-May-2007
+ * @author ropalka(a)redhat.com
*/
public class DDEndpoint
{
@@ -36,12 +36,14 @@
private String address;
private String implementor;
private String invoker;
+ private boolean mtomEnabled;
- public DDEndpoint(String id, String address, String implementor)
+ public DDEndpoint(String id, String address, String implementor, boolean mtomEnabled)
{
this.id = id;
this.address = address;
this.implementor = implementor;
+ this.mtomEnabled = mtomEnabled;
}
public void setInvoker(String invoker)
@@ -51,14 +53,22 @@
public void writeTo(Writer writer) throws IOException
{
- writer.write("<jaxws:endpoint id='" + id + "'");
- writer.write(" address='" + address + "'");
- writer.write(" implementor='" + implementor + "'");
+ writer.write("<jaxws:endpoint id='" + this.id +
"'");
+ writer.write(" address='" + this.address + "'");
+ writer.write(" implementor='" + this.implementor +
"'");
writer.write(">");
- // [JBWS-1746] Add support for configurable invoker in cxf.xml
- if (invoker != null)
- writer.write("<jaxws:invoker><bean class='" + invoker +
"'/></jaxws:invoker>");
+ if (this.mtomEnabled)
+ {
+ writer.write("<jaxws:binding>");
+ writer.write("<soap:soapBinding mtomEnabled='" +
this.mtomEnabled + "'/>");
+ writer.write("</jaxws:binding>");
+ }
+
+ if (this.invoker != null)
+ {
+ writer.write("<jaxws:invoker><bean class='" +
this.invoker + "'/></jaxws:invoker>");
+ }
writer.write("</jaxws:endpoint>");
}
@@ -66,10 +76,11 @@
public String toString()
{
StringBuilder str = new StringBuilder("Service");
- str.append("\n id=" + id);
- str.append("\n address=" + address);
- str.append("\n implementor=" + implementor);
- str.append("\n invoker=" + invoker);
+ str.append("\n id=" + this.id);
+ str.append("\n address=" + this.address);
+ str.append("\n implementor=" + this.implementor);
+ str.append("\n invoker=" + this.invoker);
+ str.append("\n mtomEnabled=" + this.mtomEnabled);
return str.toString();
}
}
Show replies by date