Author: asoldano
Date: 2014-10-10 10:50:24 -0400 (Fri, 10 Oct 2014)
New Revision: 18981
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorZ.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpointImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusCounterInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Counter.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/DeclaredInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Endpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointCounterInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/CXFClientConfigurer.java
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/CXFClientConfigurerTest.java
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/deployment/EndpointImpl.java
Log:
[JBWS-3840] Adding support for Apache CXF interceptor properties in jboss-webservices.xml
and adding additional tests (also for JBWS-3837)
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/CXFClientConfigurer.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/CXFClientConfigurer.java 2014-10-10
09:48:12 UTC (rev 18980)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/CXFClientConfigurer.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -21,24 +21,17 @@
*/
package org.jboss.wsf.stack.cxf.client.configuration;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.StringTokenizer;
import javax.xml.ws.Dispatch;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.frontend.ClientProxy;
-import org.apache.cxf.interceptor.Interceptor;
-import org.apache.cxf.interceptor.InterceptorProvider;
import org.apache.cxf.jaxws.DispatchImpl;
import org.jboss.ws.api.util.ServiceLoader;
import org.jboss.ws.common.configuration.ConfigHelper;
-import org.jboss.ws.common.utils.DelegateClassLoader;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.metadata.config.ClientConfig;
import org.jboss.wsf.spi.security.JASPIAuthenticationProvider;
@@ -92,7 +85,7 @@
public void setConfigProperties(Client client, Map<String, String> properties)
{
client.getEndpoint().putAll(properties);
- addInterceptors(client, properties);
+ InterceptorUtils.addInterceptors(client, properties);
}
private void savePropList(Client client, Map<String, String> props) {
@@ -106,67 +99,13 @@
if (previousProps != null) {
for (String p : previousProps) {
if (Constants.CXF_IN_INTERCEPTORS_PROP.equals(p)) {
- removeInterceptors(client.getInInterceptors(), (String)ep.get(p));
+ InterceptorUtils.removeInterceptors(client.getInInterceptors(),
(String)ep.get(p));
} else if (Constants.CXF_OUT_INTERCEPTORS_PROP.equals(p)) {
- removeInterceptors(client.getOutInterceptors(), (String)ep.get(p));
+ InterceptorUtils.removeInterceptors(client.getOutInterceptors(),
(String)ep.get(p));
}
ep.remove(p);
}
ep.remove(JBOSSWS_CXF_CLIENT_CONF_PROPS);
}
}
-
- public void addInterceptors(InterceptorProvider interceptorProvider, Map<String,
String> properties) {
- final String inInterceptors = properties.get(Constants.CXF_IN_INTERCEPTORS_PROP);
- if (inInterceptors != null) {
-
interceptorProvider.getInInterceptors().addAll(createInterceptors(inInterceptors));
- }
- final String outInterceptors =
properties.get(Constants.CXF_OUT_INTERCEPTORS_PROP);
- if (outInterceptors != null) {
-
interceptorProvider.getOutInterceptors().addAll(createInterceptors(outInterceptors));
- }
- }
-
- private void removeInterceptors(List<Interceptor<?>> interceptorsList,
String interceptors) {
- Set<String> set = new HashSet<String>();
- StringTokenizer st = new StringTokenizer(interceptors, ", ", false);
- while (st.hasMoreTokens()) {
- set.add(st.nextToken());
- }
- List<Interceptor<?>> toBeRemoved = new
ArrayList<Interceptor<?>>();
- for (Interceptor<?> itc : interceptorsList) {
- if (set.contains(itc.getClass().getName())) {
- toBeRemoved.add(itc);
- }
- }
- interceptorsList.removeAll(toBeRemoved);
- }
-
- private static List<Interceptor<?>> createInterceptors(String propValue)
{
- List<Interceptor<?>> list = new
ArrayList<Interceptor<?>>();
- StringTokenizer st = new StringTokenizer(propValue, ", ", false );
- while (st.hasMoreTokens()) {
- String itc = st.nextToken();
- Interceptor<?> interceptor = (Interceptor<?>)newInstance(itc);
- if (interceptor != null) {
- list.add(interceptor);
- }
- }
- return list;
- }
-
- private static Object newInstance(String className)
- {
- try
- {
- ClassLoader loader = new
DelegateClassLoader(ClassLoaderProvider.getDefaultProvider()
- .getServerIntegrationClassLoader(),
SecurityActions.getContextClassLoader());
- Class<?> clazz = SecurityActions.loadClass(loader, className);
- return clazz.newInstance();
- }
- catch (Exception e)
- {
- return null;
- }
- }
}
Added:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java
(rev 0)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.client.configuration;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.InterceptorProvider;
+import org.jboss.ws.common.utils.DelegateClassLoader;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.stack.cxf.client.Constants;
+
+/**
+ * Utils methods for adding/removing CXF interceptors
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 10-Oct-2014
+ *
+ */
+public class InterceptorUtils
+{
+ public static void addInterceptors(InterceptorProvider interceptorProvider,
Map<String, String> properties) {
+ final String inInterceptors = properties.get(Constants.CXF_IN_INTERCEPTORS_PROP);
+ if (inInterceptors != null) {
+
interceptorProvider.getInInterceptors().addAll(createInterceptors(inInterceptors));
+ }
+ final String outInterceptors =
properties.get(Constants.CXF_OUT_INTERCEPTORS_PROP);
+ if (outInterceptors != null) {
+
interceptorProvider.getOutInterceptors().addAll(createInterceptors(outInterceptors));
+ }
+ }
+
+ public static void removeInterceptors(List<Interceptor<?>>
interceptorsList, String interceptors) {
+ Set<String> set = new HashSet<String>();
+ StringTokenizer st = new StringTokenizer(interceptors, ", ", false);
+ while (st.hasMoreTokens()) {
+ set.add(st.nextToken());
+ }
+ List<Interceptor<?>> toBeRemoved = new
ArrayList<Interceptor<?>>();
+ for (Interceptor<?> itc : interceptorsList) {
+ if (set.contains(itc.getClass().getName())) {
+ toBeRemoved.add(itc);
+ }
+ }
+ interceptorsList.removeAll(toBeRemoved);
+ }
+
+ private static List<Interceptor<?>> createInterceptors(String propValue)
{
+ List<Interceptor<?>> list = new
ArrayList<Interceptor<?>>();
+ StringTokenizer st = new StringTokenizer(propValue, ", ", false );
+ while (st.hasMoreTokens()) {
+ String itc = st.nextToken();
+ Interceptor<?> interceptor = (Interceptor<?>)newInstance(itc);
+ if (interceptor != null) {
+ list.add(interceptor);
+ }
+ }
+ return list;
+ }
+
+ private static Object newInstance(String className)
+ {
+ try
+ {
+ ClassLoader loader = new
DelegateClassLoader(ClassLoaderProvider.getDefaultProvider()
+ .getServerIntegrationClassLoader(),
SecurityActions.getContextClassLoader());
+ Class<?> clazz = SecurityActions.loadClass(loader, className);
+ return clazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorUtils.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/CXFClientConfigurerTest.java
===================================================================
---
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/CXFClientConfigurerTest.java 2014-10-10
09:48:12 UTC (rev 18980)
+++
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/CXFClientConfigurerTest.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -162,10 +162,8 @@
properties.put(Constants.CXF_IN_INTERCEPTORS_PROP,
"org.jboss.wsf.stack.cxf.client.configuration.InterceptorA
org.jboss.wsf.stack.cxf.client.configuration.InterceptorB");
properties.put(Constants.CXF_OUT_INTERCEPTORS_PROP,
"org.jboss.wsf.stack.cxf.client.configuration.InterceptorC,org.jboss.wsf.stack.cxf.client.configuration.InterceptorD");
- CXFClientConfigurer cfg = new CXFClientConfigurer();
+ InterceptorUtils.addInterceptors(client, properties);
- cfg.addInterceptors(client, properties);
-
List<String> interceptors = toNameList(client.getInInterceptors());
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
@@ -182,7 +180,7 @@
properties.put(Constants.CXF_IN_INTERCEPTORS_PROP,
"org.jboss.wsf.stack.cxf.client.configuration.InterceptorD, FooInterceptor");
properties.put(Constants.CXF_OUT_INTERCEPTORS_PROP,
"org.jboss.wsf.stack.cxf.client.configuration.InterceptorB");
- cfg.addInterceptors(client, properties);
+ InterceptorUtils.addInterceptors(client, properties);
interceptors = toNameList(client.getInInterceptors());
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
@@ -243,7 +241,7 @@
properties.put(Constants.CXF_IN_INTERCEPTORS_PROP,
"org.jboss.wsf.stack.cxf.client.configuration.InterceptorD, FooInterceptor");
properties.put(Constants.CXF_OUT_INTERCEPTORS_PROP,
"org.jboss.wsf.stack.cxf.client.configuration.InterceptorB");
- cfg.addInterceptors(client, properties);
+ InterceptorUtils.addInterceptors(client, properties);
assertEquals("1", client.getEndpoint().get("A"));
assertEquals("2", client.getEndpoint().get("B"));
@@ -304,6 +302,8 @@
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
+ ClientProxy.getClient(port).getInInterceptors().add(new InterceptorZ());
+
properties = new HashMap<String, String>();
properties.put("E", "10");
properties.put("F", "20");
@@ -326,6 +326,7 @@
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
+
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorZ"));
interceptors = toNameList(client.getOutInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
@@ -350,6 +351,7 @@
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
+
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorZ"));
interceptors = toNameList(client.getOutInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
Added:
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorZ.java
===================================================================
---
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorZ.java
(rev 0)
+++
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorZ.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.client.configuration;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.message.Message;
+
+public class InterceptorZ implements Interceptor<Message> {
+
+ @Override
+ public void handleMessage(Message message) throws Fault
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void handleFault(Message message)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/client/src/test/java/org/jboss/wsf/stack/cxf/client/configuration/InterceptorZ.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
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 2014-10-10
09:48:12 UTC (rev 18980)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -68,6 +68,8 @@
import org.jboss.wsf.stack.cxf.Loggers;
import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
import org.jboss.wsf.stack.cxf.client.Constants;
+import org.jboss.wsf.stack.cxf.client.configuration.CXFClientConfigurer;
+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;
@@ -218,6 +220,8 @@
if (SoapAddressRewriteHelper.isPathRewriteRequired(sarm) ||
SoapAddressRewriteHelper.isSchemeRewriteRequired(sarm)) {
bus.getInInterceptors().add(new WSDLSoapAddressRewriteInterceptor(sarm));
}
+
+ InterceptorUtils.addInterceptors(bus, props);
}
protected static void setResourceResolver(Bus bus, ResourceResolver resourceResolver)
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-10-10
09:48:12 UTC (rev 18980)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -45,6 +45,7 @@
import org.jboss.wsf.stack.cxf.Loggers;
import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
import org.jboss.wsf.stack.cxf.client.configuration.CXFClientConfigurer;
+import org.jboss.wsf.stack.cxf.client.configuration.InterceptorUtils;
/**
@@ -107,8 +108,7 @@
{
propMap.putAll(epConfProps);
}
- CXFClientConfigurer helper = new CXFClientConfigurer();
- helper.addInterceptors(this, epConfProps);
+ InterceptorUtils.addInterceptors(this, epConfProps);
}
//handlers config is done later, as when this methods is called getBinding()
can't
//be used without messing with the servlet destinations due to the endpoint
address
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpoint.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpoint.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpoint.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name = "AnotherEndpoint", targetNamespace =
"http://org.jboss.ws.jaxws.cxf/interceptors", serviceName =
"AnotherService")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface AnotherEndpoint
+{
+ String echo(String input);
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpoint.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpointImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpointImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpointImpl.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.annotation.Resource;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.cxf.message.Message;
+import org.jboss.logging.Logger;
+
+@WebService(name = "AnotherEndpoint", targetNamespace =
"http://org.jboss.ws.jaxws.cxf/interceptors", serviceName =
"AnotherService", portName = "AnotherEndpointPort")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+(a)InInterceptors(interceptors="org.jboss.test.ws.jaxws.cxf.interceptors.DeclaredInterceptor")
+public class AnotherEndpointImpl
+{
+ private static AtomicInteger counter = new AtomicInteger(0);
+
+ @Resource
+ WebServiceContext ctx;
+
+ @WebMethod
+ public String echo(String input)
+ {
+ Logger.getLogger(this.getClass()).info("echo:." + input);
+ Message cxfMessage =
(Message)ctx.getMessageContext().get(Message.class.getName());
+ cxfMessage.getExchange().put(Counter.class, new Counter()
+ {
+ @Override
+ public void increment()
+ {
+ counter.incrementAndGet();
+ }
+ });
+ return input + "." + cxfMessage.get(StringBuilder.class) + "."
+ counter.get();
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/AnotherEndpointImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusCounterInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusCounterInterceptor.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusCounterInterceptor.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class BusCounterInterceptor extends AbstractPhaseInterceptor<Message>
+{
+ public BusCounterInterceptor()
+ {
+ super(Phase.SETUP);
+ }
+
+ public void handleMessage(Message message) throws Fault
+ {
+ Counter c = message.getExchange().get(Counter.class);
+ if (c != null) {
+ c.increment();
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusCounterInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusInterceptor.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusInterceptor.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class BusInterceptor extends AbstractPhaseInterceptor<Message>
+{
+ public BusInterceptor()
+ {
+ super(Phase.RECEIVE);
+ }
+
+ public void handleMessage(Message message) throws Fault
+ {
+ String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
+ if (!method.equals("POST"))
+ {
+ return;
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append("Foo");
+ message.put(StringBuilder.class, sb);
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/BusInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Counter.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Counter.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Counter.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+
+public interface Counter
+{
+ public void increment();
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Counter.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/DeclaredInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/DeclaredInterceptor.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/DeclaredInterceptor.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class DeclaredInterceptor extends AbstractPhaseInterceptor<Message>
+{
+ public DeclaredInterceptor()
+ {
+ super(Phase.READ);
+ }
+
+ public void handleMessage(Message message) throws Fault
+ {
+ StringBuilder sb = message.get(StringBuilder.class);
+ if (sb == null) {
+ sb = new StringBuilder();
+ message.put(StringBuilder.class, sb);
+ }
+ sb.append("!");
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/DeclaredInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Endpoint.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Endpoint.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Endpoint.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(name = "MyEndpoint", targetNamespace =
"http://org.jboss.ws.jaxws.cxf/interceptors", serviceName =
"MyService")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Endpoint
+{
+ String echo(String input);
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/Endpoint.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointCounterInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointCounterInterceptor.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointCounterInterceptor.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class EndpointCounterInterceptor extends AbstractPhaseInterceptor<Message>
+{
+ public EndpointCounterInterceptor()
+ {
+ super(Phase.SETUP);
+ }
+
+ public void handleMessage(Message message) throws Fault
+ {
+ Counter c = message.getExchange().get(Counter.class);
+ if (c != null) {
+ c.increment();
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointCounterInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointImpl.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.annotation.Resource;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.cxf.message.Message;
+import org.jboss.logging.Logger;
+
+@WebService(name = "MyEndpoint", targetNamespace =
"http://org.jboss.ws.jaxws.cxf/interceptors", serviceName =
"MyService", portName = "MyEndpointPort")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+(a)InInterceptors(interceptors="org.jboss.test.ws.jaxws.cxf.interceptors.DeclaredInterceptor")
+public class EndpointImpl
+{
+ private static AtomicInteger counter = new AtomicInteger(0);
+
+ @Resource
+ WebServiceContext ctx;
+
+ @WebMethod
+ public String echo(String input)
+ {
+ Logger.getLogger(this.getClass()).info("echo: " + input);
+ Message cxfMessage =
(Message)ctx.getMessageContext().get(Message.class.getName());
+ cxfMessage.getExchange().put(Counter.class, new Counter()
+ {
+ @Override
+ public void increment()
+ {
+ counter.incrementAndGet();
+ }
+ });
+ return input + " " + cxfMessage.get(StringBuilder.class) + " "
+ counter.get();
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointInterceptor.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointInterceptor.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class EndpointInterceptor extends AbstractPhaseInterceptor<Message>
+{
+ public EndpointInterceptor()
+ {
+ super(Phase.RECEIVE);
+ addAfter(BusInterceptor.class.getName());
+ }
+
+ public void handleMessage(Message message) throws Fault
+ {
+ StringBuilder sb = message.get(StringBuilder.class);
+ if (sb == null) {
+ sb = new StringBuilder();
+ message.put(StringBuilder.class, sb);
+ }
+ sb.append("Bar");
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/EndpointInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.test.ws.jaxws.cxf.interceptors;
+
+import java.io.File;
+import java.net.URL;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+
+/**
+ * Testcase for:
+ * [JBWS-3837] Apache CXF interceptors setup through properties
+ * [JBWS-3840] jboss-webservices.xml support for Apache CXF interceptor properties
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 10-Oct-2014
+ */
+public class InterceptorsTestCase extends JBossWSTest
+{
+ public static BaseDeployment<?>[] createDeployments() {
+ List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
+ list.add(new
JBossWSTestHelper.WarDeployment("jaxws-cxf-interceptors.war") { {
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.AnotherEndpointImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusCounterInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.DeclaredInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointCounterInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.Counter.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml"),
"jboss-webservices.xml")
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml"));
+ }
+ });
+ return list.toArray(new BaseDeployment<?>[list.size()]);
+ }
+
+ public static Test suite()
+ {
+ return new JBossWSCXFTestSetup(InterceptorsTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
+ }
+
+ public void testEndpointWithBothBusAndEndpointInterceptors() throws Exception {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-cxf-interceptors/MyService" + "?wsdl");
+ Service service = Service.create(wsdlURL, new
QName("http://org.jboss.ws.jaxws.cxf/interceptors", "MyService"));
+ Endpoint port = service.getPort(new
QName("http://org.jboss.ws.jaxws.cxf/interceptors", "MyEndpointPort"),
Endpoint.class);
+ assertEquals("Hi FooBar! 0", port.echo("Hi"));
+ assertEquals("Hi FooBar! 2", port.echo("Hi"));
+ assertEquals("Hi FooBar! 4", port.echo("Hi"));
+ assertEquals("Hi FooBar! 6", port.echo("Hi"));
+ }
+
+ public void testEndpointWithBusInterceptorsOnly() throws Exception {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-cxf-interceptors/AnotherService" + "?wsdl");
+ Service service = Service.create(wsdlURL, new
QName("http://org.jboss.ws.jaxws.cxf/interceptors",
"AnotherService"));
+ AnotherEndpoint port = service.getPort(new
QName("http://org.jboss.ws.jaxws.cxf/interceptors",
"AnotherEndpointPort"), AnotherEndpoint.class);
+ assertEquals("Hi.Foo!.0", port.echo("Hi"));
+ assertEquals("Hi.Foo!.1", port.echo("Hi"));
+ assertEquals("Hi.Foo!.2", port.echo("Hi"));
+ assertEquals("Hi.Foo!.3", port.echo("Hi"));
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jaxws-config xmlns="urn:jboss:jbossws-jaxws-config:4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xsi:schemaLocation="urn:jboss:jbossws-jaxws-config:4.0
schema/jbossws-jaxws-config_4_0.xsd">
+
+ <endpoint-config>
+
<config-name>org.jboss.test.ws.jaxws.cxf.interceptors.EndpointImpl</config-name>
+ <property>
+ <property-name>cxf.interceptors.in</property-name>
+
<property-value>org.jboss.test.ws.jaxws.cxf.interceptors.EndpointInterceptor</property-value>
+ </property>
+ <property>
+ <property-name>cxf.interceptors.out</property-name>
+
<property-value>org.jboss.test.ws.jaxws.cxf.interceptors.EndpointCounterInterceptor</property-value>
+ </property>
+ </endpoint-config>
+
+</jaxws-config>
\ No newline at end of file
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml 2014-10-10
14:50:24 UTC (rev 18981)
@@ -0,0 +1,17 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<webservices
+
xmlns="http://www.jboss.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="1.2"
+
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee">
+
+ <property>
+ <name>cxf.interceptors.in</name>
+ <value>org.jboss.test.ws.jaxws.cxf.interceptors.BusInterceptor</value>
+ </property>
+ <property>
+ <name>cxf.interceptors.out</name>
+
<value>org.jboss.test.ws.jaxws.cxf.interceptors.BusCounterInterceptor</value>
+ </property>
+
+</webservices>
\ No newline at end of file
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native