Author: alessio.soldano(a)jboss.com
Date: 2010-06-28 06:34:03 -0400 (Mon, 28 Jun 2010)
New Revision: 12526
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java
Log:
[JBWS-3002] Use the service bean created by CXF
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2010-06-28
10:31:23 UTC (rev 12525)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2010-06-28
10:34:03 UTC (rev 12526)
@@ -88,7 +88,13 @@
public abstract class AbstractInvoker implements Invoker
{
private static final Object[] NO_ARGS = new Object[]{};
+ private Object targetBean;
+ public void setTargetBean(Object targetBean)
+ {
+ this.targetBean = targetBean;
+ }
+
public Object invoke(Exchange exchange, Object o)
{
// set up the webservice request context
@@ -145,7 +151,7 @@
InvocationContext invContext = inv.getInvocationContext();
invContext.addAttachment(WebServiceContext.class, getWebServiceContext(ctx));
invContext.addAttachment(MessageContext.class, ctx);
- invContext.setTargetBean(ep.getAttachment(Object.class)); //JBWS-2486 - JBWS-3002
+ invContext.setTargetBean(targetBean != null ? targetBean :
ep.getAttachment(Object.class)); //JBWS-2486 - JBWS-3002
inv.setJavaMethod(m);
inv.setArgs(params);
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java 2010-06-28
10:31:23 UTC (rev 12525)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java 2010-06-28
10:34:03 UTC (rev 12526)
@@ -21,6 +21,9 @@
*/
package org.jboss.wsf.stack.cxf.configuration;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.service.invoker.Invoker;
+import org.jboss.wsf.stack.cxf.AbstractInvoker;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSCXFConfigurer;
import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
@@ -50,6 +53,10 @@
{
configureEndpoint((EndpointImpl)beanInstance);
}
+ else if (beanInstance instanceof ServerFactoryBean)
+ {
+ configureServerFactory((ServerFactoryBean)beanInstance);
+ }
super.customConfigure(beanInstance);
}
@@ -62,6 +69,16 @@
}
}
+ protected synchronized void configureServerFactory(ServerFactoryBean factory)
+ {
+ //propagate serviceBean object (the endpoint target) from the factory to the
jbossws custom invoker
+ Invoker invoker = factory.getInvoker();
+ if (invoker instanceof AbstractInvoker)
+ {
+ ((AbstractInvoker)invoker).setTargetBean(factory.getServiceBean());
+ }
+ }
+
public void setWsdlPublisher(WSDLFilePublisher wsdlPublisher)
{
this.wsdlPublisher = wsdlPublisher;
Show replies by date