Author: jim.ma
Date: 2015-04-16 06:19:15 -0400 (Thu, 16 Apr 2015)
New Revision: 19642
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java
Removed:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EnableDecoupledFaultInterceptor.java
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointAssociationInterceptor.java
Log:
[JBWS-3905]:Fix NPE;Refactor work to better name the new added interceptor
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-04-16
09:44:59 UTC (rev 19641)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-04-16
10:19:15 UTC (rev 19642)
@@ -70,7 +70,7 @@
import org.jboss.wsf.stack.cxf.client.configuration.InterceptorUtils;
import org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher;
import org.jboss.wsf.stack.cxf.extensions.policy.PolicySetsAnnotationListener;
-import org.jboss.wsf.stack.cxf.interceptor.EnableDecoupledFaultInterceptor;
+import org.jboss.wsf.stack.cxf.interceptor.MessagePropertySettingInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.EndpointAssociationInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.HandlerAuthInterceptor;
import org.jboss.wsf.stack.cxf.interceptor.NsCtxSelectorStoreInterceptor;
@@ -206,7 +206,7 @@
//Install the EndpointAssociationInterceptor for linking every message exchange
//with the proper spi Endpoint retrieved in CXFServletExt
bus.getInInterceptors().add(new EndpointAssociationInterceptor());
- bus.getInInterceptors().add(new EnableDecoupledFaultInterceptor());
+ bus.getInInterceptors().add(new MessagePropertySettingInterceptor());
bus.getInInterceptors().add(new NsCtxSelectorStoreInterceptor());
final String p = (props != null) ?
props.get(Constants.JBWS_CXF_DISABLE_HANDLER_AUTH_CHECKS) : null;
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EnableDecoupledFaultInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EnableDecoupledFaultInterceptor.java 2015-04-16
09:44:59 UTC (rev 19641)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EnableDecoupledFaultInterceptor.java 2015-04-16
10:19:15 UTC (rev 19642)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf.interceptor;
-
-import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
-import org.apache.cxf.phase.Phase;
-import org.apache.cxf.ws.addressing.soap.MAPCodec;
-
-/**
- * This interceptor adds the context property decoupled_fault_support
- * to enable decoupled faultTo. This is an optional feature in cxf and we
- * need this to be default to make it same behavior with native stack.
- * @author <a href="mailto:ema@redhat.com>Jim Ma</a>
- */
-public class EnableDecoupledFaultInterceptor extends
AbstractPhaseInterceptor<Message>
-{
-
- public EnableDecoupledFaultInterceptor()
- {
- super(Phase.PRE_PROTOCOL);
- addBefore(MAPCodec.class.getName());
- }
-
- public void handleMessage(Message message)
- {
- message.put("org.apache.cxf.ws.addressing.decoupled_fault_support",
true);
- }
-
- public void handleFault(Message message)
- {
- //complete
- }
-
-}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointAssociationInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointAssociationInterceptor.java 2015-04-16
09:44:59 UTC (rev 19641)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/EndpointAssociationInterceptor.java 2015-04-16
10:19:15 UTC (rev 19642)
@@ -22,13 +22,11 @@
package org.jboss.wsf.stack.cxf.interceptor;
import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.EndpointType;
import org.jboss.wsf.spi.invocation.EndpointAssociation;
/**
@@ -44,8 +42,7 @@
public class EndpointAssociationInterceptor extends
AbstractPhaseInterceptor<Message>
{
- private EjbWSOneWayThreadInterceptor ejbOneWayInterceptor = new
EjbWSOneWayThreadInterceptor();
-
+
public EndpointAssociationInterceptor()
{
super(Phase.RECEIVE);
@@ -56,31 +53,6 @@
{
Endpoint endpoint = EndpointAssociation.getEndpoint();
Exchange exchange = message.getExchange();
-
exchange.put(Endpoint.class, endpoint);
- message.getInterceptorChain().add(ejbOneWayInterceptor);
-
}
-
- public class EjbWSOneWayThreadInterceptor extends
AbstractPhaseInterceptor<Message>
- {
- public EjbWSOneWayThreadInterceptor()
- {
- super(Phase.PRE_LOGICAL);
- this.addBefore(OneWayProcessorInterceptor.class.getName());
- }
-
- @Override
- public void handleMessage(Message message) throws Fault
- {
-
- Endpoint endpoint = message.getExchange().get(Endpoint.class);
- //Use original thread for oneway message to avoid authorization failure in ejb
container for webservice endpoint
- if (endpoint.getType() == EndpointType.JAXWS_EJB3 &&
message.getExchange().isOneWay() && !isRequestor(message))
- {
- message.put(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, true);
- }
-
- }
- }
}
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java 2015-04-16
10:19:15 UTC (rev 19642)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.interceptor;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.ws.addressing.soap.MAPCodec;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.EndpointType;
+
+/**
+ * This interceptor adds the following context properties to cxf message:
+ * <p>1.decoupled_fault_support<p>
+ * It enables decoupled faultTo. This is an optional feature in cxf and we
+ * need this to be default to make it same behavior with native stack.
+ * <p>2.OneWayProcessorInterceptor.USE_ORIGINAL_THREAD<p>
+ * This will force one way operation to use original thread for ejb webserivce endpoint
+ * <p>to avoid authorization failure from ejb container
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ */
+public class MessagePropertySettingInterceptor extends
AbstractPhaseInterceptor<Message>
+{
+ private EjbWSOneWayThreadInterceptor ejbOneWayInterceptor = new
EjbWSOneWayThreadInterceptor();
+
+ public MessagePropertySettingInterceptor()
+ {
+ super(Phase.PRE_PROTOCOL);
+ addBefore(MAPCodec.class.getName());
+ }
+
+ public void handleMessage(Message message)
+ {
+ message.put("org.apache.cxf.ws.addressing.decoupled_fault_support",
true);
+ message.getInterceptorChain().add(ejbOneWayInterceptor);
+ }
+
+ public void handleFault(Message message)
+ {
+ //complete
+ }
+
+ public class EjbWSOneWayThreadInterceptor extends
AbstractPhaseInterceptor<Message>
+ {
+ public EjbWSOneWayThreadInterceptor()
+ {
+ super(Phase.PRE_LOGICAL);
+ this.addBefore(OneWayProcessorInterceptor.class.getName());
+ }
+
+ @Override
+ public void handleMessage(Message message) throws Fault
+ {
+
+ Endpoint endpoint = message.getExchange().get(Endpoint.class);
+ if (endpoint == null)
+ {
+ return;
+ }
+ //Use original thread for oneway message to avoid authorization failure in ejb
container for webservice endpoint
+ if (endpoint.getType() == EndpointType.JAXWS_EJB3 &&
message.getExchange().isOneWay() && !isRequestor(message))
+ {
+ message.put(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, true);
+ }
+
+ }
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native