JBossWS SVN: r18694 - in stack/cxf/trunk: modules/client and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-05-26 05:20:26 -0400 (Mon, 26 May 2014)
New Revision: 18694
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/asyncclient/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/asyncclient/WEB-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/asyncclient/WEB-INF/web.xml
Modified:
stack/cxf/trunk/modules/client/pom.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/pom.xml
Log:
[JBWS-3630]:Add dependency to enable http async client conduit
Modified: stack/cxf/trunk/modules/client/pom.xml
===================================================================
--- stack/cxf/trunk/modules/client/pom.xml 2014-05-26 09:16:48 UTC (rev 18693)
+++ stack/cxf/trunk/modules/client/pom.xml 2014-05-26 09:20:26 UTC (rev 18694)
@@ -71,6 +71,10 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-hc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-jms</artifactId>
</dependency>
<dependency>
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2014-05-26 09:16:48 UTC (rev 18693)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2014-05-26 09:20:26 UTC (rev 18694)
@@ -30,6 +30,16 @@
<mkdir dir="${tests.output.dir}/test-libs"/>
+ <!-- jaxws-cxf-asyncclient -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-cxf-asyncclient.war" webxml="${tests.output.dir}/test-resources/jaxws/cxf/asyncclient/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl*.class"/>
+ </classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
+ </war>
+
<!-- jaxws-cxf-bus -->
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-bus.war" webxml="${tests.output.dir}/test-resources/jaxws/cxf/bus/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-05-26 09:20:26 UTC (rev 18694)
@@ -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.asyncclient;
+
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.wsf.test.JBossWSTest;
+
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class AsyncClientTestCase extends JBossWSTest
+{
+ private String endpointAddress = "http://" + getServerHost() + ":8080/jaxws-cxf-asyncclient";
+
+ public static Test suite()
+ {
+ return new JBossWSCXFTestSetup(AsyncClientTestCase.class, "jaxws-cxf-asyncclient.war");
+ }
+
+ public void testAsycClienWithHCAddress() throws Exception
+ {
+ QName serviceName = new QName("http://org.jboss.ws/cxf/asyncclient", "EndpointImplService");
+ URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint proxy = service.getPort(Endpoint.class);
+ BindingProvider provider = (BindingProvider)proxy;
+ Map<String, Object> requestContext = provider.getRequestContext();
+ requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "hc://" + endpointAddress);
+ assertEquals("Echo:1000", proxy.echo(1000));
+ }
+
+}
\ No newline at end of file
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.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/asyncclient/Endpoint.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java 2014-05-26 09:20:26 UTC (rev 18694)
@@ -0,0 +1,37 @@
+/*
+ * 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.asyncclient;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+/**
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+@WebService(name = "EndpointService", targetNamespace = "http://org.jboss.ws/cxf/asyncclient")
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+public interface Endpoint
+{
+ @WebMethod
+ public String echo(long time);
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/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/asyncclient/EndpointImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java 2014-05-26 09:20:26 UTC (rev 18694)
@@ -0,0 +1,58 @@
+/*
+ * 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.asyncclient;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.continuations.Continuation;
+import org.apache.cxf.continuations.ContinuationProvider;
+/**
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+@WebService(name = "EndpointService", targetNamespace = "http://org.jboss.ws/cxf/asyncclient")
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+public class EndpointImpl
+{
+ @Resource
+ private WebServiceContext context;
+
+ public String echo(long time) {
+ ContinuationProvider p = (ContinuationProvider)
+ context.getMessageContext().get(ContinuationProvider.class.getName());
+ Continuation c = p.getContinuation();
+ if (c.isNew()) {
+ if (time < 0) {
+ c.suspend(-time);
+ } else {
+ c.suspend(2000 - (time % 1000));
+ }
+ return null;
+ }
+ return "Echo:" + time;
+ }
+
+
+}
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/asyncclient/WEB-INF/web.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/asyncclient/WEB-INF/web.xml (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/asyncclient/WEB-INF/web.xml 2014-05-26 09:20:26 UTC (rev 18694)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
+ version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+ <servlet>
+ <servlet-name>AsyncClientService</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.cxf.asyncclient.EndpointImpl</servlet-class>
+ <async-supported>true</async-supported>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>AsyncClientService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Property changes on: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/asyncclient/WEB-INF/web.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2014-05-26 09:16:48 UTC (rev 18693)
+++ stack/cxf/trunk/pom.xml 2014-05-26 09:20:26 UTC (rev 18694)
@@ -463,6 +463,11 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-hc</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-mex</artifactId>
<version>${cxf.version}</version>
</dependency>
10 years, 7 months
JBossWS SVN: r18693 - stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-26 05:16:48 -0400 (Mon, 26 May 2014)
New Revision: 18693
Modified:
stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
Log:
Fixing error in testcase
Modified: stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
===================================================================
--- stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-26 09:16:23 UTC (rev 18692)
+++ stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-26 09:16:48 UTC (rev 18693)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * 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.
*
@@ -610,7 +610,7 @@
public void testAutoRewriteCodeFirstContext() throws Exception
{
setModifySOAPAddress(true);
- final String addContext = "jaxws-jbws2150-codefirst";
+ final String addContext = "xx/jaxws-jbws2150-codefirst";
final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
setWebServicePath(sedCmd);
setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
@@ -646,7 +646,7 @@
public void testAutoRewriteContext() throws Exception
{
setModifySOAPAddress(true);
- final String addContext = "jaxws-jbws2150";
+ final String addContext = "xx/jaxws-jbws2150";
final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
setWebServicePath(sedCmd);
setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
@@ -755,7 +755,6 @@
wsdlReader.setFeature("javax.wsdl.verbose", false);
Definition definition = wsdlReader.readWSDL(null, wsdlLocation);
- Map services = definition.getServices();
return definition;
}
10 years, 7 months
JBossWS SVN: r18692 - in stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org: unix4j and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-26 05:16:23 -0400 (Mon, 26 May 2014)
New Revision: 18692
Added:
stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/unix4j/
stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/unix4j/main/
stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/unix4j/main/module.xml
Log:
Adding file likely forgotten by rsearls in previous commit
Added: stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/unix4j/main/module.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/unix4j/main/module.xml (rev 0)
+++ stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/unix4j/main/module.xml 2014-05-26 09:16:23 UTC (rev 18692)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., 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.
+ -->
+
+<module xmlns="urn:jboss:module:1.1" name="org.unix4j">
+
+ <properties>
+ <property name="jboss.api" value="private"/>
+ </properties>
+
+ <resources>
+ <!-- Insert resources here -->
+ </resources>
+
+ <dependencies/>
+</module>
Property changes on: stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/unix4j/main/module.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
10 years, 7 months
JBossWS SVN: r18691 - in stack/cxf/branches/rsearls: modules/dist and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-05-25 16:50:19 -0400 (Sun, 25 May 2014)
New Revision: 18691
Modified:
stack/cxf/branches/rsearls/modules/dist/pom.xml
stack/cxf/branches/rsearls/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml
stack/cxf/branches/rsearls/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/cxf/branches/rsearls/modules/server/pom.xml
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
stack/cxf/branches/rsearls/pom.xml
Log:
added support for unix4j SED utility
Modified: stack/cxf/branches/rsearls/modules/dist/pom.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/dist/pom.xml 2014-05-23 16:31:34 UTC (rev 18690)
+++ stack/cxf/branches/rsearls/modules/dist/pom.xml 2014-05-25 20:50:19 UTC (rev 18691)
@@ -128,6 +128,15 @@
<artifactId>opensaml</artifactId>
<scope>provided</scope>
</dependency>
+ <!-- Java Sed utilities -->
+ <dependency>
+ <groupId>org.unix4j</groupId>
+ <artifactId>unix4j-base</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.unix4j</groupId>
+ <artifactId>unix4j-command</artifactId>
+ </dependency>
<!-- container integration -->
<dependency>
<groupId>org.jboss.ws</groupId>
Modified: stack/cxf/branches/rsearls/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2014-05-23 16:31:34 UTC (rev 18690)
+++ stack/cxf/branches/rsearls/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2014-05-25 20:50:19 UTC (rev 18691)
@@ -67,6 +67,8 @@
<include>javax.jws:jsr181-api:jar</include>
<include>org.codehaus.woodstox:stax2-api:jar</include>
<include>org.codehaus.woodstox:woodstox-core-asl:jar</include>
+ <include>org.unix4j:unix4j-base:jar</include>
+ <include>org.unix4j:unix4j-command:jar</include>
</includes>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
Modified: stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml 2014-05-23 16:31:34 UTC (rev 18690)
+++ stack/cxf/branches/rsearls/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml 2014-05-25 20:50:19 UTC (rev 18691)
@@ -74,5 +74,6 @@
<include path="META-INF"/>
</imports>
</module>
+ <module name="org.unix4j"/>
</dependencies>
</module>
Modified: stack/cxf/branches/rsearls/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-05-23 16:31:34 UTC (rev 18690)
+++ stack/cxf/branches/rsearls/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-05-25 20:50:19 UTC (rev 18691)
@@ -130,6 +130,11 @@
<include name="**/jbossws-(a){jbossid}-server-integration.jar"/>
</fileset>
</copy>
+ <copy todir="@{targetdir}/org/unix4j/main" flatten="false" overwrite="true">
+ <fileset dir="@{thirdpartydir}/lib">
+ <include name="**/unix4j*.jar"/>
+ </fileset>
+ </copy>
<!-- module.xml files -->
<installModules targetDir="@{targetdir}">
<fileset dir="@{thirdpartydir}/modules/@{modules-jbossid}">
Modified: stack/cxf/branches/rsearls/modules/server/pom.xml
===================================================================
--- stack/cxf/branches/rsearls/modules/server/pom.xml 2014-05-23 16:31:34 UTC (rev 18690)
+++ stack/cxf/branches/rsearls/modules/server/pom.xml 2014-05-25 20:50:19 UTC (rev 18691)
@@ -253,6 +253,17 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.unix4j</groupId>
+ <artifactId>unix4j-base</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.unix4j</groupId>
+ <artifactId>unix4j-command</artifactId>
+ </dependency>
+
</dependencies>
<!-- Plugins -->
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-23 16:31:34 UTC (rev 18690)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-25 20:50:19 UTC (rev 18691)
@@ -27,6 +27,7 @@
import java.net.URL;
import org.jboss.wsf.spi.management.ServerConfig;
+import org.unix4j.Unix4j;
/**
* Helper for rewriting soap:address in published wsdl
@@ -149,8 +150,7 @@
sb.append(port);
// replace original context-root with replacement context
if (additionalCcontext != null && additionalCcontext.length() > 0) {
- String tmpAdditionalCcontext = additionalCcontext.startsWith("/") ? additionalCcontext : "/" + additionalCcontext;
- String tmpPath = path.replace(contextRoot, tmpAdditionalCcontext);
+ String tmpPath = Unix4j.builder().echo(path).sed(additionalCcontext).toStringResult();
sb.append(tmpPath);
} else
{
@@ -192,8 +192,7 @@
{
final URL url = new URL(address);
final String path = url.getPath();
- final String tmpAdditionalCcontext = additionalCcontext.startsWith("/") ? additionalCcontext : "/" + additionalCcontext;
- final String tmpPath = path.replace(contextRoot, tmpAdditionalCcontext);
+ final String tmpPath = Unix4j.builder().echo(path).sed(additionalCcontext).toStringResult();
final String newUrl=url.toString().replace(path, tmpPath);
ADDRESS_REWRITE_LOGGER.addressRewritten(address, newUrl);
Modified: stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
===================================================================
--- stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-23 16:31:34 UTC (rev 18690)
+++ stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-25 20:50:19 UTC (rev 18691)
@@ -537,7 +537,8 @@
{
setModifySOAPAddress(true);
final String addContext = "xx/jaxws-jbws2150";
- setWebServicePath(addContext);
+ final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
+ setWebServicePath(sedCmd);
deploy("jaxws-jbws2150.war");
try
{
@@ -583,7 +584,8 @@
{
setModifySOAPAddress(true);
final String addContext = "xx/jaxws-jbws2150-codefirst";
- setWebServicePath(addContext);
+ final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
+ setWebServicePath(sedCmd);
deploy("jaxws-jbws2150-codefirst.war");
try
{
@@ -609,7 +611,8 @@
{
setModifySOAPAddress(true);
final String addContext = "jaxws-jbws2150-codefirst";
- setWebServicePath("xx/" + addContext);
+ final String sedCmd = "s/jaxws-jbws2150-codefirst/xx\\/jaxws-jbws2150-codefirst/g";
+ setWebServicePath(sedCmd);
setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
deploy("jaxws-jbws2150-codefirst.war");
try
@@ -644,7 +647,8 @@
{
setModifySOAPAddress(true);
final String addContext = "jaxws-jbws2150";
- setWebServicePath("xx/" + addContext);
+ final String sedCmd = "s/jaxws-jbws2150/xx\\/jaxws-jbws2150/g";
+ setWebServicePath(sedCmd);
setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
deploy("jaxws-jbws2150.war");
try
Modified: stack/cxf/branches/rsearls/pom.xml
===================================================================
--- stack/cxf/branches/rsearls/pom.xml 2014-05-23 16:31:34 UTC (rev 18690)
+++ stack/cxf/branches/rsearls/pom.xml 2014-05-25 20:50:19 UTC (rev 18691)
@@ -111,6 +111,7 @@
<shrinkwrap.version>1.1.3</shrinkwrap.version>
<jaspi.api.version>1.0.0.Alpha1</jaspi.api.version>
<javax.inject.version>1</javax.inject.version>
+ <unix4j-version>0.3</unix4j-version>
</properties>
@@ -1269,7 +1270,17 @@
<artifactId>easymockclassextension</artifactId>
<version>2.4</version>
</dependency>
-
+ <!-- Java SED util -->
+ <dependency>
+ <groupId>org.unix4j</groupId>
+ <artifactId>unix4j-base</artifactId>
+ <version>${unix4j-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.unix4j</groupId>
+ <artifactId>unix4j-command</artifactId>
+ <version>${unix4j-version}</version>
+ </dependency>
<!-- Other test dependencies -->
<dependency>
<groupId>org.picketlink</groupId>
10 years, 7 months
JBossWS SVN: r18690 - stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-23 12:31:34 -0400 (Fri, 23 May 2014)
New Revision: 18690
Modified:
stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
Log:
Enriching testcase
Modified: stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
===================================================================
--- stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-22 20:49:08 UTC (rev 18689)
+++ stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-23 16:31:34 UTC (rev 18690)
@@ -576,6 +576,7 @@
/**
* Test soap:address rewrite. The new address contains the webServicePath setting.
+ *
* @throws Exception
*/
public void testRewriteCodeFirstContext() throws Exception
@@ -586,14 +587,12 @@
deploy("jaxws-jbws2150-codefirst.war");
try
{
- final String testHost = getServerHost();
- final String expectedWsdlHost = getServerHost();
- final String addr = "http://" + testHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService";
- final String wsdlLocation = addr + "?wsdl";
+ final String serverHost = getServerHost();
+ final String wsdlLocation = "http://" + serverHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("http://" + expectedWsdlHost + ":8080/" + addContext +"/CodeFirstService", address);
+ assertEquals("http://" + serverHost + ":8080/" + addContext +"/CodeFirstService", address);
}
finally
{
@@ -602,8 +601,8 @@
}
/**
- * Test soap:address rewrite. The address does not change because of the
- * webServiceHost setting.
+ * Test soap:address rewrite with code-first endpoint and context set
+ *
* @throws Exception
*/
public void testAutoRewriteCodeFirstContext() throws Exception
@@ -615,15 +614,18 @@
deploy("jaxws-jbws2150-codefirst.war");
try
{
- final String testHost = getServerHost();
- final String expectedWsdlHost = getServerHost();
- final String addr = "http://" + testHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService";
- final String wsdlLocation = addr + "?wsdl";
+ String serverHost = getServerHost();
+ final String wsdlLocation = "http://" + serverHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService?wsdl";
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
- assertEquals("http://" + expectedWsdlHost + ":8080/" + addContext +"/CodeFirstService", address);
-
+ assertEquals("http://" + serverHost + ":8080/" + addContext +"/CodeFirstService", address);
+
+ if (isTestsuiteServerHostLocalhost()) {
+ definition = getWSDLDefinition("http://127.0.0.1:8080/jaxws-jbws2150-codefirst/CodeFirstService?wsdl");
+ address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://127.0.0.1:8080/" + addContext +"/CodeFirstService", address);
+ }
}
finally
{
@@ -632,8 +634,8 @@
}
/**
- * Test soap:address rewrite. The addresses should not be rewritten because
- * of the webServiceHost setting.
+ * Test soap:address rewrite with host configured to ServerConfig.UNDEFINED_HOSTNAME and context set
+ *
* (see MetadataBuilder#processAddressRewrite)
*
* @throws Exception
@@ -647,29 +649,35 @@
deploy("jaxws-jbws2150.war");
try
{
+ final Map<String, String> wsdlLocationsMap = new HashMap<String, String>();
final String serverHost = getServerHost();
- final List<String> wsdlLocations = new LinkedList<String>();
- wsdlLocations.add("http://" + serverHost + ":8080/jaxws-jbws2150/ValidURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":8080/jaxws-jbws2150/InvalidURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":8080/jaxws-jbws2150/ValidSecureURL?wsdl");
- wsdlLocations.add("http://" + serverHost + ":8080/jaxws-jbws2150/InvalidSecureURL?wsdl");
-
- // the addresses should not be rewritten because of the webServiceHost setting.
- for (final String wsdlLocation : wsdlLocations)
- {
+ wsdlLocationsMap.put("http://" + serverHost + ":8080/jaxws-jbws2150/ValidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":8080/jaxws-jbws2150/InvalidURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":8080/jaxws-jbws2150/ValidSecureURL?wsdl", serverHost);
+ wsdlLocationsMap.put("http://" + serverHost + ":8080/jaxws-jbws2150/InvalidSecureURL?wsdl", serverHost);
+ if (isTestsuiteServerHostLocalhost()) {
+ wsdlLocationsMap.put("http://127.0.0.1:8080/jaxws-jbws2150/ValidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:8080/jaxws-jbws2150/InvalidURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:8080/jaxws-jbws2150/ValidSecureURL?wsdl", "127.0.0.1");
+ wsdlLocationsMap.put("http://127.0.0.1:8080/jaxws-jbws2150/InvalidSecureURL?wsdl", "127.0.0.1");
+ }
+
+ for (Entry<String, String> entry : wsdlLocationsMap.entrySet()) {
+ String wsdlLocation = entry.getKey();
+ String host = entry.getValue();
Definition definition = getWSDLDefinition(wsdlLocation);
String address = getPortAddress(definition, "ValidURLService", "ValidURLPort");
- assertEquals("http://" + serverHost + ":8080/" + addContext + "/ValidURL", address);
+ assertEquals("http://" + host + ":8080/" + addContext + "/ValidURL", address);
address = getPortAddress(definition, "InvalidURLService", "InvalidURLPort");
- assertEquals("http://" + serverHost + ":8080/" + addContext + "/InvalidURL", address);
+ assertEquals("http://" + host + ":8080/" + addContext + "/InvalidURL", address);
address = getPortAddress(definition, "ValidSecureURLService", "ValidSecureURLPort");
- assertEquals("http://" + serverHost + ":8080/" + addContext + "/ValidSecureURL", address);
+ assertEquals("http://" + host + ":8080/" + addContext + "/ValidSecureURL", address);
address = getPortAddress(definition, "InvalidSecureURLService", "InvalidSecureURLPort");
- assertEquals("http://" + serverHost + ":8080/" + addContext + "/InvalidSecureURL", address);
+ assertEquals("http://" + host + ":8080/" + addContext + "/InvalidSecureURL", address);
//check wsdl import (which is bound to the endpoint currently serving the wsdl)
assertTrue(getWsdlImportAddress(definition).contains(addContext));
10 years, 7 months
JBossWS SVN: r18689 - in stack/cxf/branches/rsearls/modules: server/src/main/java/org/jboss/wsf/stack/cxf/deployment and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-05-22 16:49:08 -0400 (Thu, 22 May 2014)
New Revision: 18689
Removed:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
Modified:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
Log:
support for code-first soap address rewrite
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-22 07:19:21 UTC (rev 18688)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java 2014-05-22 20:49:08 UTC (rev 18689)
@@ -182,4 +182,33 @@
}
}
+
+ public static String rewriteSoapAddress(ServerConfig serverConfig, String address, String contextRoot)
+ {
+ try
+ {
+ final String additionalCcontext = serverConfig.getWebServicePath();
+ if (serverConfig.isModifySOAPAddress() && (additionalCcontext != null && additionalCcontext.length() > 0))
+ {
+ final URL url = new URL(address);
+ final String path = url.getPath();
+ final String tmpAdditionalCcontext = additionalCcontext.startsWith("/") ? additionalCcontext : "/" + additionalCcontext;
+ final String tmpPath = path.replace(contextRoot, tmpAdditionalCcontext);
+ final String newUrl=url.toString().replace(path, tmpPath);
+
+ ADDRESS_REWRITE_LOGGER.addressRewritten(address, newUrl);
+ return newUrl;
+ } else
+ {
+ ADDRESS_REWRITE_LOGGER.rewriteNotRequired(address);
+ return address;
+ }
+
+ } catch (Exception e)
+ {
+ ADDRESS_REWRITE_LOGGER.invalidAddressProvidedUseItWithoutRewriting(address, "");
+ return address;
+ }
+ }
+
}
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-05-22 07:19:21 UTC (rev 18688)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-05-22 20:49:08 UTC (rev 18689)
@@ -21,27 +21,32 @@
*/
package org.jboss.wsf.stack.cxf.deployment;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
import org.apache.cxf.Bus;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.frontend.WSDLGetInterceptor;
-import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.frontend.WSDLGetUtils;
import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
-import org.apache.cxf.message.Message;
import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
import org.jboss.ws.common.configuration.ConfigHelper;
+import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.metadata.config.CommonConfig;
import org.jboss.wsf.stack.cxf.Loggers;
-import org.jboss.wsf.stack.cxf.interceptor.WSDLSoapAddressRewriteInterceptor;
+import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.net.URL;
+import java.security.AccessController;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.jboss.wsf.stack.cxf.Loggers.ADDRESS_REWRITE_LOGGER;
+
/**
* An extension of @see org.apache.cxf.jaxws.EndpointImpl for dealing with
* JBossWS integration needs.
@@ -70,23 +75,7 @@
{
super.getServerFactory().setBlockPostConstruct(true);
super.doPublish(addr);
- /**/
- //-- rls test start
- Collection<Endpoint> epList = super.getService().getEndpoints().values();
- for(Endpoint ep: epList){
- List<Interceptor<? extends Message>> inList = ep.getInInterceptors();
- for(Interceptor in: inList){
- if (in instanceof org.apache.cxf.frontend.WSDLGetInterceptor){
- int index = inList.indexOf(in);
- if (index > -1){
- inList.remove(index);
- inList.add(index, WSDLSoapAddressRewriteInterceptor.INSTANCE);
- }
- }
- }
- }
- //-- rls test end
- /**/
+
//allow for configuration so that the wsdlPublisher can be set be the JBossWSCXFConfigurer
configureObject(this);
setupConfigHandlers();
@@ -150,6 +139,7 @@
if (wsdlLocation == null) {
JaxWsImplementorInfo info = new JaxWsImplementorInfo(getImplementorClass());
wsdlLocation = info.getWsdlLocation();
+ updateCodeFirstSoapAddress();
}
wsdlPublisher.publishWsdlFiles(service.getName(), wsdlLocation, this.getBus(), service.getServiceInfos());
}
@@ -195,4 +185,31 @@
this.wsdlPublisher = wsdlPublisher;
}
+ /**
+ * In the code-first scenario, reset the endpoint address so that it is
+ * written to the generated wsdl file.
+ */
+ private void updateCodeFirstSoapAddress() {
+ ServerConfig servConfig = getServerConfig();
+ if (!SoapAddressRewriteHelper.isAutoRewriteOn(servConfig)) {
+ //- code-first handling
+ List<ServiceInfo> sevInfos = getServer().getEndpoint().getService().getServiceInfos();
+ for (ServiceInfo si: sevInfos){
+ Collection<EndpointInfo > epInfos = si.getEndpoints();
+ for(EndpointInfo ei: epInfos){
+ String publishedEndpointUrl = (String)ei.getProperty(WSDLGetUtils.PUBLISHED_ENDPOINT_URL);
+ if (publishedEndpointUrl != null){
+ ei.setAddress(publishedEndpointUrl);
+ }
+ }
+ }
+ }
+ }
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
}
Deleted: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-05-22 07:19:21 UTC (rev 18688)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-05-22 20:49:08 UTC (rev 18689)
@@ -1,126 +0,0 @@
-package org.jboss.wsf.stack.cxf.interceptor;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
-import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.common.util.UrlUtils;
-import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.frontend.WSDLGetInterceptor;
-import org.apache.cxf.frontend.WSDLGetOutInterceptor;
-import org.apache.cxf.frontend.WSDLGetUtils;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.Interceptor;
-import org.apache.cxf.interceptor.MessageSenderInterceptor;
-import org.apache.cxf.interceptor.OutgoingChainInterceptor;
-import org.apache.cxf.interceptor.StaxOutInterceptor;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
-import org.apache.cxf.phase.Phase;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
-import org.w3c.dom.Document;
-
-
-/**
- * This is a customization of org.apache.cxf.frontend.WSDLGetInterceptor. It
- * enables the handling of rewriting the path of a URL.
- * Date: 5/19/14
- */
-public class WSDLSoapAddressRewriteInterceptor extends AbstractPhaseInterceptor<Message> {
- public static final WSDLSoapAddressRewriteInterceptor INSTANCE =
- new WSDLSoapAddressRewriteInterceptor();
- private static final String TRANSFORM_SKIP = "transform.skip";
- private Interceptor<Message> wsdlGetOutInterceptor = WSDLGetOutInterceptor.INSTANCE;
-
- public WSDLSoapAddressRewriteInterceptor() {
- super(Phase.READ);
- getAfter().add(EndpointSelectionInterceptor.class.getName());
- }
-
- public WSDLSoapAddressRewriteInterceptor(Interceptor<Message> outInterceptor) {
- this();
- // Let people override the wsdlGetOutInterceptor
- wsdlGetOutInterceptor = outInterceptor;
- }
-
- public void handleMessage(Message message) throws Fault {
- String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
- String query = (String)message.get(Message.QUERY_STRING);
-
- if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
- return;
- }
-
- String baseUri = (String)message.get(Message.REQUEST_URL);
- String ctx = (String)message.get(Message.PATH_INFO);
-
- Map<String, String> map = UrlUtils.parseQueryString(query);
- if (isRecognizedQuery(map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) {
- Document doc = getDocument(message, baseUri, map, ctx);
-
- Endpoint e = message.getExchange().get(Endpoint.class);
- Message mout = new MessageImpl();
- mout.setExchange(message.getExchange());
- mout = e.getBinding().createMessage(mout);
- mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
- message.getExchange().setOutMessage(mout);
-
- mout.put(WSDLGetInterceptor.DOCUMENT_HOLDER, doc);
- mout.put(Message.CONTENT_TYPE, "text/xml");
-
- // just remove the interceptor which should not be used
- cleanUpOutInterceptors(mout);
-
- // notice this is being added after the purge above, don't swap the order!
- mout.getInterceptorChain().add(wsdlGetOutInterceptor);
-
- message.getExchange().put(TRANSFORM_SKIP, Boolean.TRUE);
- // skip the service executor and goto the end of the chain.
- message.getInterceptorChain().doInterceptStartingAt(
- message,
- OutgoingChainInterceptor.class.getName());
- }
- }
-
- protected void cleanUpOutInterceptors(Message outMessage) {
- // TODO - how can I improve this to provide a specific interceptor chain that just has the
- // stax, gzip and message sender components, while also ensuring that GZIP is only provided
- // if its already configured for the endpoint.
- Iterator<Interceptor<? extends Message>> iterator = outMessage.getInterceptorChain().iterator();
- while (iterator.hasNext()) {
- Interceptor<? extends Message> inInterceptor = iterator.next();
- if (!inInterceptor.getClass().equals(StaxOutInterceptor.class)
- && !inInterceptor.getClass().equals(GZIPOutInterceptor.class)
- && !inInterceptor.getClass().equals(MessageSenderInterceptor.class)) {
- outMessage.getInterceptorChain().remove(inInterceptor);
- }
- }
-
- }
-
- private Document getDocument(Message message, String base, Map<String, String> params, String ctxUri) {
- // cannot have two wsdl's being generated for the same endpoint at the same
- // time as the addresses may get mixed up
- // For WSDL's the WSDLWriter does not share any state between documents.
- // For XSD's, the WSDLSoapAddressRewriteUtils makes a copy of any XSD schema documents before updating
- // any addresses and returning them, so for both WSDL and XSD this is the only part that needs
- // to be synchronized.
- synchronized (message.getExchange().getEndpoint()) {
- return new WSDLGetUtils().getDocument(message, base, params, ctxUri,
- message.getExchange().getEndpoint().getEndpointInfo());
- }
- }
-
- private boolean isRecognizedQuery(Map<String, String> map, String baseUri, String ctx,
- EndpointInfo endpointInfo) {
-
- if (map.containsKey("wsdl") || map.containsKey("xsd")) {
- return true;
- }
- return false;
- }
-
-}
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-05-22 07:19:21 UTC (rev 18688)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java 2014-05-22 20:49:08 UTC (rev 18689)
@@ -21,25 +21,6 @@
*/
package org.jboss.wsf.stack.cxf.metadata;
-import static org.jboss.wsf.stack.cxf.Loggers.METADATA_LOGGER;
-import static org.jboss.wsf.stack.cxf.Messages.MESSAGES;
-
-import java.net.URL;
-import java.security.AccessController;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.StringTokenizer;
-
-import javax.jws.WebService;
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.WebServiceProvider;
-import javax.xml.ws.soap.MTOM;
-import javax.xml.ws.soap.SOAPBinding;
-
import org.jboss.ws.common.JavaUtils;
import org.jboss.ws.common.deployment.SOAPAddressWSDLParser;
import org.jboss.ws.common.management.AbstractServerConfig;
@@ -59,6 +40,19 @@
import org.jboss.wsf.stack.cxf.metadata.services.DDBeans;
import org.jboss.wsf.stack.cxf.metadata.services.DDEndpoint;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.soap.MTOM;
+import javax.xml.ws.soap.SOAPBinding;
+import java.net.URL;
+import java.security.AccessController;
+import java.util.*;
+
+import static org.jboss.wsf.stack.cxf.Loggers.METADATA_LOGGER;
+import static org.jboss.wsf.stack.cxf.Messages.MESSAGES;
+
/**
* Builds the DDBeans metadata used for generating the jboss-cxf.xml deployment descriptor
*
@@ -308,7 +302,9 @@
} else {
//same comment as above regarding auto rewrite...
if (!SoapAddressRewriteHelper.isAutoRewriteOn(sc)) {
- ddep.setPublishedEndpointUrl(ddep.getAddress()); //force computed address for code first endpoints
+ //- code-first handling
+ String base = SoapAddressRewriteHelper.rewriteSoapAddress(sc, ddep.getAddress(), dep.getService().getContextRoot());
+ ddep.setPublishedEndpointUrl(base); //force computed address for code first endpoints
}
}
}
@@ -363,5 +359,5 @@
return sb.toString();
}
-
+
}
Modified: stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java
===================================================================
--- stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-22 07:19:21 UTC (rev 18688)
+++ stack/cxf/branches/rsearls/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2150/JBWS2150TestCaseForked.java 2014-05-22 20:49:08 UTC (rev 18689)
@@ -530,8 +530,7 @@
}
/**
- *
- *
+ * Test soap:address rewrite. The new address contains the webServicePath setting.
* @throws Exception
*/
public void testRewriteContext() throws Exception
@@ -576,7 +575,65 @@
}
/**
- * This is not passing, as the auto rewrite mechanism clashes with the context rewrite one
+ * Test soap:address rewrite. The new address contains the webServicePath setting.
+ * @throws Exception
+ */
+ public void testRewriteCodeFirstContext() throws Exception
+ {
+ setModifySOAPAddress(true);
+ final String addContext = "xx/jaxws-jbws2150-codefirst";
+ setWebServicePath(addContext);
+ deploy("jaxws-jbws2150-codefirst.war");
+ try
+ {
+ final String testHost = getServerHost();
+ final String expectedWsdlHost = getServerHost();
+ final String addr = "http://" + testHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService";
+ final String wsdlLocation = addr + "?wsdl";
+
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://" + expectedWsdlHost + ":8080/" + addContext +"/CodeFirstService", address);
+ }
+ finally
+ {
+ undeploy("jaxws-jbws2150-codefirst.war");
+ }
+ }
+
+ /**
+ * Test soap:address rewrite. The address does not change because of the
+ * webServiceHost setting.
+ * @throws Exception
+ */
+ public void testAutoRewriteCodeFirstContext() throws Exception
+ {
+ setModifySOAPAddress(true);
+ final String addContext = "jaxws-jbws2150-codefirst";
+ setWebServicePath("xx/" + addContext);
+ setWebServiceHost(ServerConfig.UNDEFINED_HOSTNAME);
+ deploy("jaxws-jbws2150-codefirst.war");
+ try
+ {
+ final String testHost = getServerHost();
+ final String expectedWsdlHost = getServerHost();
+ final String addr = "http://" + testHost + ":8080/jaxws-jbws2150-codefirst/CodeFirstService";
+ final String wsdlLocation = addr + "?wsdl";
+
+ Definition definition = getWSDLDefinition(wsdlLocation);
+ String address = getPortAddress(definition, "CodeFirstService", "CodeFirstPort");
+ assertEquals("http://" + expectedWsdlHost + ":8080/" + addContext +"/CodeFirstService", address);
+
+ }
+ finally
+ {
+ undeploy("jaxws-jbws2150-codefirst.war");
+ }
+ }
+
+ /**
+ * Test soap:address rewrite. The addresses should not be rewritten because
+ * of the webServiceHost setting.
* (see MetadataBuilder#processAddressRewrite)
*
* @throws Exception
@@ -638,7 +695,7 @@
}
assertEquals(endpoint.echo("hello"), "hello");
}
-
+
private static boolean isTestsuiteServerHostLocalhost() {
return "localhost".equals(getServerHost());
}
10 years, 7 months
JBossWS SVN: r18688 - stack/cxf/trunk.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-22 03:19:21 -0400 (Thu, 22 May 2014)
New Revision: 18688
Modified:
stack/cxf/trunk/pom.xml
Log:
[JBWS-3686] Moving to released CXF 3.0.0 version
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2014-05-21 09:51:22 UTC (rev 18687)
+++ stack/cxf/trunk/pom.xml 2014-05-22 07:19:21 UTC (rev 18688)
@@ -71,7 +71,7 @@
<wildfly810.version>8.1.0.CR2</wildfly810.version>
<wildfly900.version>9.0.0.Alpha1-SNAPSHOT</wildfly900.version>
<ejb.api.version>1.0.2.Final</ejb.api.version>
- <cxf.version>3.0.0-SNAPSHOT</cxf.version>
+ <cxf.version>3.0.0</cxf.version>
<cxf.asm.version>3.3.1</cxf.asm.version>
<cxf.xjcplugins.version>2.7.0</cxf.xjcplugins.version>
<jboss.common.core.version>2.2.17.GA</jboss.common.core.version>
10 years, 7 months
JBossWS SVN: r18687 - stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-05-21 05:51:22 -0400 (Wed, 21 May 2014)
New Revision: 18687
Modified:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
Log:
Fixing compilation error + using proper WSDLGetInterceptor.DOCUMENT_HOLDER key to store the document in the Message for later retrieval in WSDLGetOutInterceptor
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-05-20 20:21:58 UTC (rev 18686)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-05-21 09:51:22 UTC (rev 18687)
@@ -1,16 +1,20 @@
package org.jboss.wsf.stack.cxf.interceptor;
+import java.util.Iterator;
+import java.util.Map;
+
import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.common.util.UrlUtils;
import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.frontend.WSDLGetInterceptor;
import org.apache.cxf.frontend.WSDLGetOutInterceptor;
import org.apache.cxf.frontend.WSDLGetUtils;
-import org.jboss.ws.common.management.AbstractServerConfig;
-import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
-import org.jboss.wsf.stack.cxf.interceptor.util.WSDLSoapAddressRewriteUtils;
-import org.apache.cxf.interceptor.*;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
+import org.apache.cxf.interceptor.OutgoingChainInterceptor;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -19,11 +23,7 @@
import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
import org.w3c.dom.Document;
-import java.security.AccessController;
-import java.util.Iterator;
-import java.util.Map;
-
/**
* This is a customization of org.apache.cxf.frontend.WSDLGetInterceptor. It
* enables the handling of rewriting the path of a URL.
@@ -32,8 +32,6 @@
public class WSDLSoapAddressRewriteInterceptor extends AbstractPhaseInterceptor<Message> {
public static final WSDLSoapAddressRewriteInterceptor INSTANCE =
new WSDLSoapAddressRewriteInterceptor();
- public static final String DOCUMENT_HOLDER =
- WSDLSoapAddressRewriteInterceptor.class.getName() + ".documentHolder";
private static final String TRANSFORM_SKIP = "transform.skip";
private Interceptor<Message> wsdlGetOutInterceptor = WSDLGetOutInterceptor.INSTANCE;
@@ -70,7 +68,7 @@
mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
message.getExchange().setOutMessage(mout);
- mout.put(DOCUMENT_HOLDER, doc);
+ mout.put(WSDLGetInterceptor.DOCUMENT_HOLDER, doc);
mout.put(Message.CONTENT_TYPE, "text/xml");
// just remove the interceptor which should not be used
10 years, 7 months
JBossWS SVN: r18686 - stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-05-20 16:21:58 -0400 (Tue, 20 May 2014)
New Revision: 18686
Modified:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
Log:
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-05-20 20:17:18 UTC (rev 18685)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-05-20 20:21:58 UTC (rev 18686)
@@ -125,12 +125,4 @@
return false;
}
-
- private static ServerConfig getServerConfig() {
- if(System.getSecurityManager() == null) {
- return AbstractServerConfig.getServerIntegrationServerConfig();
- }
- return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
- }
-
}
10 years, 7 months
JBossWS SVN: r18685 - in stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf: interceptor and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: rsearls
Date: 2014-05-20 16:17:18 -0400 (Tue, 20 May 2014)
New Revision: 18685
Added:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
Modified:
stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
Log:
replace WSDLGetInterceptor with jbossws's WSDLSoapAddressRewriteInterceptor
Modified: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-05-20 10:24:27 UTC (rev 18684)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2014-05-20 20:17:18 UTC (rev 18685)
@@ -22,7 +22,9 @@
package org.jboss.wsf.stack.cxf.deployment;
import java.io.IOException;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
@@ -30,11 +32,15 @@
import org.apache.cxf.Bus;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.frontend.WSDLGetInterceptor;
+import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
+import org.apache.cxf.message.Message;
import org.apache.cxf.service.Service;
import org.jboss.ws.common.configuration.ConfigHelper;
import org.jboss.wsf.spi.metadata.config.CommonConfig;
import org.jboss.wsf.stack.cxf.Loggers;
+import org.jboss.wsf.stack.cxf.interceptor.WSDLSoapAddressRewriteInterceptor;
/**
* An extension of @see org.apache.cxf.jaxws.EndpointImpl for dealing with
@@ -64,6 +70,23 @@
{
super.getServerFactory().setBlockPostConstruct(true);
super.doPublish(addr);
+ /**/
+ //-- rls test start
+ Collection<Endpoint> epList = super.getService().getEndpoints().values();
+ for(Endpoint ep: epList){
+ List<Interceptor<? extends Message>> inList = ep.getInInterceptors();
+ for(Interceptor in: inList){
+ if (in instanceof org.apache.cxf.frontend.WSDLGetInterceptor){
+ int index = inList.indexOf(in);
+ if (index > -1){
+ inList.remove(index);
+ inList.add(index, WSDLSoapAddressRewriteInterceptor.INSTANCE);
+ }
+ }
+ }
+ }
+ //-- rls test end
+ /**/
//allow for configuration so that the wsdlPublisher can be set be the JBossWSCXFConfigurer
configureObject(this);
setupConfigHandlers();
Added: stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java
===================================================================
--- stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java (rev 0)
+++ stack/cxf/branches/rsearls/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/WSDLSoapAddressRewriteInterceptor.java 2014-05-20 20:17:18 UTC (rev 18685)
@@ -0,0 +1,136 @@
+package org.jboss.wsf.stack.cxf.interceptor;
+
+import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.util.UrlUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.frontend.WSDLGetOutInterceptor;
+import org.apache.cxf.frontend.WSDLGetUtils;
+import org.jboss.ws.common.management.AbstractServerConfig;
+import org.jboss.wsf.spi.management.ServerConfig;
+import org.jboss.wsf.stack.cxf.addressRewrite.SoapAddressRewriteHelper;
+import org.jboss.wsf.stack.cxf.interceptor.util.WSDLSoapAddressRewriteUtils;
+import org.apache.cxf.interceptor.*;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
+import org.w3c.dom.Document;
+
+import java.security.AccessController;
+import java.util.Iterator;
+import java.util.Map;
+
+
+/**
+ * This is a customization of org.apache.cxf.frontend.WSDLGetInterceptor. It
+ * enables the handling of rewriting the path of a URL.
+ * Date: 5/19/14
+ */
+public class WSDLSoapAddressRewriteInterceptor extends AbstractPhaseInterceptor<Message> {
+ public static final WSDLSoapAddressRewriteInterceptor INSTANCE =
+ new WSDLSoapAddressRewriteInterceptor();
+ public static final String DOCUMENT_HOLDER =
+ WSDLSoapAddressRewriteInterceptor.class.getName() + ".documentHolder";
+ private static final String TRANSFORM_SKIP = "transform.skip";
+ private Interceptor<Message> wsdlGetOutInterceptor = WSDLGetOutInterceptor.INSTANCE;
+
+ public WSDLSoapAddressRewriteInterceptor() {
+ super(Phase.READ);
+ getAfter().add(EndpointSelectionInterceptor.class.getName());
+ }
+
+ public WSDLSoapAddressRewriteInterceptor(Interceptor<Message> outInterceptor) {
+ this();
+ // Let people override the wsdlGetOutInterceptor
+ wsdlGetOutInterceptor = outInterceptor;
+ }
+
+ public void handleMessage(Message message) throws Fault {
+ String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
+ String query = (String)message.get(Message.QUERY_STRING);
+
+ if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
+ return;
+ }
+
+ String baseUri = (String)message.get(Message.REQUEST_URL);
+ String ctx = (String)message.get(Message.PATH_INFO);
+
+ Map<String, String> map = UrlUtils.parseQueryString(query);
+ if (isRecognizedQuery(map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) {
+ Document doc = getDocument(message, baseUri, map, ctx);
+
+ Endpoint e = message.getExchange().get(Endpoint.class);
+ Message mout = new MessageImpl();
+ mout.setExchange(message.getExchange());
+ mout = e.getBinding().createMessage(mout);
+ mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
+ message.getExchange().setOutMessage(mout);
+
+ mout.put(DOCUMENT_HOLDER, doc);
+ mout.put(Message.CONTENT_TYPE, "text/xml");
+
+ // just remove the interceptor which should not be used
+ cleanUpOutInterceptors(mout);
+
+ // notice this is being added after the purge above, don't swap the order!
+ mout.getInterceptorChain().add(wsdlGetOutInterceptor);
+
+ message.getExchange().put(TRANSFORM_SKIP, Boolean.TRUE);
+ // skip the service executor and goto the end of the chain.
+ message.getInterceptorChain().doInterceptStartingAt(
+ message,
+ OutgoingChainInterceptor.class.getName());
+ }
+ }
+
+ protected void cleanUpOutInterceptors(Message outMessage) {
+ // TODO - how can I improve this to provide a specific interceptor chain that just has the
+ // stax, gzip and message sender components, while also ensuring that GZIP is only provided
+ // if its already configured for the endpoint.
+ Iterator<Interceptor<? extends Message>> iterator = outMessage.getInterceptorChain().iterator();
+ while (iterator.hasNext()) {
+ Interceptor<? extends Message> inInterceptor = iterator.next();
+ if (!inInterceptor.getClass().equals(StaxOutInterceptor.class)
+ && !inInterceptor.getClass().equals(GZIPOutInterceptor.class)
+ && !inInterceptor.getClass().equals(MessageSenderInterceptor.class)) {
+ outMessage.getInterceptorChain().remove(inInterceptor);
+ }
+ }
+
+ }
+
+ private Document getDocument(Message message, String base, Map<String, String> params, String ctxUri) {
+ // cannot have two wsdl's being generated for the same endpoint at the same
+ // time as the addresses may get mixed up
+ // For WSDL's the WSDLWriter does not share any state between documents.
+ // For XSD's, the WSDLSoapAddressRewriteUtils makes a copy of any XSD schema documents before updating
+ // any addresses and returning them, so for both WSDL and XSD this is the only part that needs
+ // to be synchronized.
+ synchronized (message.getExchange().getEndpoint()) {
+ return new WSDLGetUtils().getDocument(message, base, params, ctxUri,
+ message.getExchange().getEndpoint().getEndpointInfo());
+ }
+ }
+
+ private boolean isRecognizedQuery(Map<String, String> map, String baseUri, String ctx,
+ EndpointInfo endpointInfo) {
+
+ if (map.containsKey("wsdl") || map.containsKey("xsd")) {
+ return true;
+ }
+ return false;
+ }
+
+
+ private static ServerConfig getServerConfig() {
+ if(System.getSecurityManager() == null) {
+ return AbstractServerConfig.getServerIntegrationServerConfig();
+ }
+ return AccessController.doPrivileged(AbstractServerConfig.GET_SERVER_INTEGRATION_SERVER_CONFIG);
+ }
+
+}
10 years, 7 months