Author: jim.ma
Date: 2014-08-13 04:21:37 -0400 (Wed, 13 Aug 2014)
New Revision: 18842
Modified:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSComponentInstanceAssociationInterceptor.java
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandler.java
Log:
[JBWS-3514]:Back port fix to wildfly810 branch
Modified:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSComponentInstanceAssociationInterceptor.java
===================================================================
---
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSComponentInstanceAssociationInterceptor.java 2014-08-11
10:08:14 UTC (rev 18841)
+++
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/deployers/WSComponentInstanceAssociationInterceptor.java 2014-08-13
08:21:37 UTC (rev 18842)
@@ -24,6 +24,7 @@
import org.jboss.as.ee.component.BasicComponentInstance;
import org.jboss.as.ee.component.Component;
import org.jboss.as.ee.component.ComponentInstance;
+import org.jboss.as.naming.ManagedReference;
import org.jboss.as.webservices.injection.WSComponent;
import org.jboss.invocation.ImmediateInterceptorFactory;
import org.jboss.invocation.Interceptor;
@@ -44,7 +45,13 @@
@Override
public Object processInvocation(final InterceptorContext interceptorContext) throws
Exception {
final WSComponent wsComponent =
(WSComponent)interceptorContext.getPrivateData(Component.class);
- final BasicComponentInstance pojoComponentInstance =
wsComponent.getComponentInstance();
+ BasicComponentInstance pojoComponentInstance = null;
+ if (interceptorContext.getPrivateData(ManagedReference.class) != null) {
+ ManagedReference reference =
interceptorContext.getPrivateData(ManagedReference.class);
+ pojoComponentInstance =
(BasicComponentInstance)wsComponent.createInstance(reference.getInstance());
+ } else {
+ pojoComponentInstance = wsComponent.getComponentInstance();
+ }
interceptorContext.putPrivateData(ComponentInstance.class,
pojoComponentInstance);
return interceptorContext.proceed();
}
Modified:
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandler.java
===================================================================
---
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandler.java 2014-08-11
10:08:14 UTC (rev 18841)
+++
container/wildfly81/branches/jbossws-wildfly810/server-integration/src/main/java/org/jboss/as/webservices/invocation/AbstractInvocationHandler.java 2014-08-13
08:21:37 UTC (rev 18842)
@@ -77,7 +77,7 @@
if (componentView == null) {
componentView = getMSCService(componentViewName, ComponentView.class);
if (componentView == null) {
- throw MESSAGES.cannotFindComponentView(componentViewName);
+ throw MESSAGES.cannotFindComponentView(componentViewName);
}
if (reference == null) {
try {
@@ -103,22 +103,24 @@
try {
// prepare for invocation
onBeforeInvocation(wsInvocation);
- //for spring integration we don't need to go into ee's interceptors
- if(wsInvocation.getInvocationContext().getTargetBean() != null &&
endpoint.getProperty("SpringBus") != null) {
- this.reference = new ManagedReference() {
- public void release() {
- }
-
- public Object getInstance() {
- return wsInvocation.getInvocationContext().getTargetBean();
- }
- };
- }
// prepare invocation data
final ComponentView componentView = getComponentView();
Component component = componentView.getComponent();
- if (component instanceof WSComponent &&
endpoint.getProperty("SpringBus") != null) {
- ((WSComponent)component).setReference(reference);
+ //for spring integration and @FactoryType is annotated we don't need to go
into ee's interceptors
+ if(wsInvocation.getInvocationContext().getTargetBean() != null
+ && (endpoint.getProperty("SpringBus") != null)
+ ||
wsInvocation.getInvocationContext().getProperty("forceTargetBean") != null) {
+ this.reference = new ManagedReference() {
+ public void release() {
+ }
+
+ public Object getInstance() {
+ return wsInvocation.getInvocationContext().getTargetBean();
+ }
+ };
+ if (component instanceof WSComponent) {
+ ((WSComponent) component).setReference(reference);
+ }
}
final Method method = getComponentViewMethod(wsInvocation.getJavaMethod(),
componentView.getViewMethods());
final InterceptorContext context = new InterceptorContext();
@@ -127,13 +129,16 @@
context.setParameters(wsInvocation.getArgs());
context.putPrivateData(Component.class, component);
context.putPrivateData(ComponentView.class, componentView);
+ if(wsInvocation.getInvocationContext().getProperty("forceTargetBean")
!= null) {
+ context.putPrivateData(ManagedReference.class, reference);
+ }
// invoke method
final Object retObj = componentView.invoke(context);
// set return value
wsInvocation.setReturnValue(retObj);
}
catch (Throwable t) {
-
WSLogger.ROOT_LOGGER.error(MESSAGES.methodInvocationFailed(t.getLocalizedMessage()), t);
+
WSLogger.ROOT_LOGGER.error(MESSAGES.methodInvocationFailed(t.getLocalizedMessage()), t);
handleInvocationException(t);
}
finally {
@@ -210,5 +215,4 @@
return true;
}
-}
-
+}
\ No newline at end of file
Show replies by date