Start working on removing all the JAXB 2.1 and JAX-WS 2.1 code and profiles
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/67432aef Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/67432aef Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/67432aef Branch: refs/heads/master Commit: 67432aef1adb8e330c054431de9d0955e3993472 Parents: 08d98fb Author: Daniel Kulp <[email protected]> Authored: Thu Jul 24 09:39:30 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Thu Jul 24 09:40:05 2014 -0400 ---------------------------------------------------------------------- distribution/manifest/pom.xml | 5 +- distribution/pom.xml | 6 +- parent/pom.xml | 54 +-- rt/databinding/jaxb/pom.xml | 19 - rt/databinding/xmlbeans/pom.xml | 12 - rt/frontend/jaxws/pom.xml | 251 +---------- .../org/apache/cxf/jaxws22/EndpointImpl.java | 116 ++++++ .../org/apache/cxf/jaxws22/JAXWS22Invoker.java | 43 ++ .../apache/cxf/jaxws22/spi/ProviderImpl.java | 76 ++++ .../spring/JAXWS22SpringEndpointImpl.java | 56 +++ .../http_jaxws_spi/HttpHandlerImpl.java | 71 ++++ .../HttpServletRequestAdapter.java | 414 +++++++++++++++++++ .../HttpServletResponseAdapter.java | 245 +++++++++++ .../http_jaxws_spi/JAXWSHttpSpiDestination.java | 123 ++++++ .../JAXWSHttpSpiTransportFactory.java | 52 +++ .../org/apache/cxf/jaxws22/EndpointImpl.java | 116 ------ .../org/apache/cxf/jaxws22/JAXWS22Invoker.java | 43 -- .../apache/cxf/jaxws22/spi/ProviderImpl.java | 76 ---- .../spring/JAXWS22SpringEndpointImpl.java | 56 --- .../http_jaxws_spi/HttpHandlerImpl.java | 71 ---- .../HttpServletRequestAdapter.java | 414 ------------------- .../HttpServletResponseAdapter.java | 245 ----------- .../http_jaxws_spi/JAXWSHttpSpiDestination.java | 123 ------ .../JAXWSHttpSpiTransportFactory.java | 52 --- .../META-INF/services/javax.xml.ws.spi.Provider | 1 + .../META-INF/services/javax.xml.ws.spi.Provider | 1 - rt/rs/security/cors/pom.xml | 5 - systests/container-integration/pom.xml | 9 +- systests/ws-rm/pom.xml | 55 --- systests/ws-security-examples/pom.xml | 10 - systests/ws-security/pom.xml | 10 - systests/ws-specs/pom.xml | 73 ---- .../cxf/systest/ws/addr_responses/Hello.java | 31 ++ .../systest/ws/addr_responses/HelloImpl.java | 34 ++ .../systest/ws/addr_responses/HelloService.java | 43 ++ .../cxf/systest/ws/addr_responses/Server.java | 58 +++ .../WSAResponsesClientServerTest.java | 66 +++ .../cxf/systest/ws/addr_responses/Hello.java | 31 -- .../systest/ws/addr_responses/HelloImpl.java | 34 -- .../systest/ws/addr_responses/HelloService.java | 43 -- .../cxf/systest/ws/addr_responses/Server.java | 58 --- .../WSAResponsesClientServerTest.java | 66 --- 42 files changed, 1437 insertions(+), 1930 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/distribution/manifest/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/manifest/pom.xml b/distribution/manifest/pom.xml index 2475ee0..2f6043e 100644 --- a/distribution/manifest/pom.xml +++ b/distribution/manifest/pom.xml @@ -33,9 +33,6 @@ <properties> <maven.test.skip>true</maven.test.skip> <cxf.version>${project.version}</cxf.version> - <cxf.jaxb.version>${cxf.jaxb22.version}</cxf.jaxb.version> - <cxf.jaxb.impl.version>${cxf.jaxb22.impl.version}</cxf.jaxb.impl.version> - <cxf.jaxb.xjc.version>${cxf.jaxb22.impl.version}</cxf.jaxb.xjc.version> </properties> <dependencies> <dependency> @@ -381,7 +378,7 @@ <!-- Add entries for the stuff that needs to be endorsed on Java6, but not on java5 --> <!-- Stick both versions of jaxb xjc/impl on classpath to make it easier to flip back and forth --> <Class-Path> - cxf-${project.version}.jar endorsed/jaxb-api-${cxf.jaxb22.version}.jar endorsed/geronimo-jaxws_2.2_spec-${cxf.specs.jaxws.api.version}.jar jaxb-impl-${cxf.jaxb22.impl.version}.jar jaxb-core-${cxf.jaxb22.core.version}.jar jaxb-impl-${cxf.jaxb21.impl.version}.jar jaxb-core-${cxf.jaxb21.core.version}.jar jaxb-xjc-${cxf.jaxb22.xjc.version}.jar jaxb-xjc-${cxf.jaxb21.xjc.version}.jar + cxf-${project.version}.jar endorsed/jaxb-api-${cxf.jaxb.version}.jar endorsed/geronimo-jaxws_2.2_spec-${cxf.specs.jaxws.api.version}.jar jaxb-impl-${cxf.jaxb.impl.version}.jar jaxb-core-${cxf.jaxb.core.version}.jar </Class-Path> </manifestEntries> </archive> http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/distribution/pom.xml ---------------------------------------------------------------------- diff --git a/distribution/pom.xml b/distribution/pom.xml index 45f3af7..26313b8 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -34,10 +34,6 @@ <maven.test.skip>true</maven.test.skip> <cxf.version>${project.version}</cxf.version> <cxf.checkstyle.extension>-corba</cxf.checkstyle.extension> - <cxf.jaxb.version>${cxf.jaxb22.version}</cxf.jaxb.version> - <cxf.jaxb.impl.version>${cxf.jaxb22.impl.version}</cxf.jaxb.impl.version> - <cxf.jaxb.core.version>${cxf.jaxb22.core.version}</cxf.jaxb.core.version> - <cxf.jaxb.xjc.version>${cxf.jaxb22.xjc.version}</cxf.jaxb.xjc.version> </properties> <modules> <module>manifest</module> @@ -457,7 +453,7 @@ <artifactItem> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> - <version>${cxf.jaxb22.version}</version> + <version>${cxf.jaxb.version}</version> <outputDirectory>${project.build.directory}/libs/endorsed</outputDirectory> </artifactItem> <artifactItem> http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index cf27f83..85a8114 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -107,19 +107,10 @@ <cxf.geronimo.transaction.version>1.1.1</cxf.geronimo.transaction.version> <cxf.jasypt.bundle.version>1.9.0_1</cxf.jasypt.bundle.version> <cxf.javax.ws.rs.version>2.0</cxf.javax.ws.rs.version> - <cxf.jaxb21.version>2.1</cxf.jaxb21.version> - <cxf.jaxb21.impl.version>2.1.14</cxf.jaxb21.impl.version> - <cxf.jaxb21.core.version>2.1.14</cxf.jaxb21.core.version> - <cxf.jaxb21.xjc.version>2.1.14</cxf.jaxb21.xjc.version> - <cxf.jaxb22.version>2.2.11</cxf.jaxb22.version> - <cxf.jaxb22.impl.version>2.2.10-b140310.1920</cxf.jaxb22.impl.version> - <cxf.jaxb22.core.version>2.2.10-b140310.1920</cxf.jaxb22.core.version> - <cxf.jaxb22.xjc.version>2.2.10-b140310.1920</cxf.jaxb22.xjc.version> - <!-- by default, we use jaxb 2.1, but java5 profile will override to 2.2 --> - <cxf.jaxb.version>${cxf.jaxb21.version}</cxf.jaxb.version> - <cxf.jaxb.impl.version>${cxf.jaxb21.impl.version}</cxf.jaxb.impl.version> - <cxf.jaxb.core.version>${cxf.jaxb21.core.version}</cxf.jaxb.core.version> - <cxf.jaxb.xjc.version>${cxf.jaxb21.xjc.version}</cxf.jaxb.xjc.version> + <cxf.jaxb.version>2.2.11</cxf.jaxb.version> + <cxf.jaxb.impl.version>2.2.10-b140310.1920</cxf.jaxb.impl.version> + <cxf.jaxb.core.version>2.2.10-b140310.1920</cxf.jaxb.core.version> + <cxf.jaxb.xjc.version>2.2.10-b140310.1920</cxf.jaxb.xjc.version> <cxf.joda.time.version>2.2</cxf.joda.time.version> <cxf.jdom.version>1.0</cxf.jdom.version> <cxf.jettison.version>1.3.5</cxf.jettison.version> @@ -1726,48 +1717,11 @@ </dependencyManagement> <profiles> <profile> - <id>jdk17</id> - <activation> - <jdk>1.7</jdk> - </activation> - <properties> - <cxf.jaxb.version>${cxf.jaxb22.version}</cxf.jaxb.version> - <cxf.jaxb.impl.version>${cxf.jaxb22.impl.version}</cxf.jaxb.impl.version> - <cxf.jaxb.xjc.version>${cxf.jaxb22.impl.version}</cxf.jaxb.xjc.version> - <cxf.jaxb.core.version>${cxf.jaxb22.core.version}</cxf.jaxb.core.version> - </properties> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <showDeprecation>${cxf.compile.show.deprecation}</showDeprecation> - <showWarnings>true</showWarnings> - <compilerArgument>${cxf.compile.flags}</compilerArgument> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-pmd-plugin</artifactId> - </plugin> - </plugins> - </build> - </profile> - <profile> <id>jdk18</id> <activation> <jdk>1.8</jdk> </activation> <properties> - <cxf.jaxb.version>${cxf.jaxb22.version}</cxf.jaxb.version> - <cxf.jaxb.impl.version>${cxf.jaxb22.impl.version}</cxf.jaxb.impl.version> - <cxf.jaxb.xjc.version>${cxf.jaxb22.impl.version}</cxf.jaxb.xjc.version> - <cxf.jaxb.core.version>${cxf.jaxb22.core.version}</cxf.jaxb.core.version> <cxf.codegen.jvmArgs>-Djavax.xml.accessExternalSchema=file</cxf.codegen.jvmArgs> </properties> <build> http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/databinding/jaxb/pom.xml ---------------------------------------------------------------------- diff --git a/rt/databinding/jaxb/pom.xml b/rt/databinding/jaxb/pom.xml index 7efc11c..106697a 100644 --- a/rt/databinding/jaxb/pom.xml +++ b/rt/databinding/jaxb/pom.xml @@ -110,23 +110,4 @@ <optional>true</optional> </dependency> </dependencies> - <profiles> - <profile> - <id>jdk15</id> - <activation> - <jdk>1.5</jdk> - </activation> - <dependencies> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jaxws_2.2_spec</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-activation_1.1_spec</artifactId> - </dependency> - </dependencies> - </profile> - </profiles> </project> http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/databinding/xmlbeans/pom.xml ---------------------------------------------------------------------- diff --git a/rt/databinding/xmlbeans/pom.xml b/rt/databinding/xmlbeans/pom.xml index 4194695..6a8c21c 100644 --- a/rt/databinding/xmlbeans/pom.xml +++ b/rt/databinding/xmlbeans/pom.xml @@ -173,18 +173,6 @@ </build> <profiles> <profile> - <id>jdk15</id> - <activation> - <jdk>1.5</jdk> - </activation> - <dependencies> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-stax-api_1.0_spec</artifactId> - </dependency> - </dependencies> - </profile> - <profile> <id>setup.eclipse</id> <build> <defaultGoal>process-test-sources</defaultGoal> http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/pom.xml ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/pom.xml b/rt/frontend/jaxws/pom.xml index 9153c34..1b9f1c8 100644 --- a/rt/frontend/jaxws/pom.xml +++ b/rt/frontend/jaxws/pom.xml @@ -31,7 +31,6 @@ <relativePath>../../../parent/pom.xml</relativePath> </parent> <properties> - <cxf.spi-dir>spi-2.1</cxf.spi-dir> <cxf.osgi.import> javax.servlet*;version="${cxf.osgi.javax.servlet.version}", org.apache.aries*;version="${cxf.aries.version.range}";resolution:=optional, @@ -103,7 +102,7 @@ <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>${project.version}</version> - <scope>test</scope> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.cxf</groupId> @@ -181,252 +180,4 @@ <scope>test</scope> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-spi</id> - <phase>generate-resources</phase> - <goals> - <goal>add-resource</goal> - </goals> - <configuration> - <resources> - <resource> - <directory>${basedir}/src/main/${cxf.spi-dir}</directory> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - <profiles> - <profile> - <id>jaxws22</id> - <dependencies> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jaxws_2.2_spec</artifactId> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - <properties> - <cxf.spi-dir>spi-2.2</cxf.spi-dir> - </properties> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-jaxws22-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${basedir}/src/main/jaxws22</source> - </sources> - </configuration> - </execution> - <execution> - <id>add-jaxws22-test-source</id> - <phase>generate-test-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>${basedir}/src/test/jaxws22</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>create-endorsed-dir</id> - <phase>validate</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jaxws_2.2_spec</artifactId> - <outputDirectory>${basedir}/target/endorsed</outputDirectory> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <compilerArguments> - <endorseddirs>${basedir}/target/endorsed</endorseddirs> - </compilerArguments> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - </profile> - <profile> - <id>release</id> - <dependencies> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jaxws_2.2_spec</artifactId> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - <properties> - <cxf.spi-dir>spi-2.2</cxf.spi-dir> - </properties> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-jaxws22-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${basedir}/src/main/jaxws22</source> - </sources> - </configuration> - </execution> - <execution> - <id>add-jaxws22-test-source</id> - <phase>generate-test-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>${basedir}/src/test/jaxws22</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>create-endorsed-dir</id> - <phase>validate</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jaxws_2.2_spec</artifactId> - <outputDirectory>${basedir}/target/endorsed</outputDirectory> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <compilerArguments> - <endorseddirs>${basedir}/target/endorsed</endorseddirs> - </compilerArguments> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - </profile> - <profile> - <id>jdk17</id> - <activation> - <jdk>[1.7,1.9)</jdk> - </activation> - <properties> - <cxf.spi-dir>spi-2.2</cxf.spi-dir> - </properties> - <dependencies> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-jaxws22-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${basedir}/src/main/jaxws22</source> - </sources> - </configuration> - </execution> - <execution> - <id>add-jaxws22-test-source</id> - <phase>generate-test-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>${basedir}/src/test/jaxws22</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> </project> http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/EndpointImpl.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/EndpointImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/EndpointImpl.java new file mode 100644 index 0000000..7c38466 --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/EndpointImpl.java @@ -0,0 +1,116 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.jaxws22; + +import javax.xml.ws.EndpointContext; +import javax.xml.ws.WebServiceFeature; + +import org.apache.cxf.Bus; +import org.apache.cxf.frontend.ServerFactoryBean; +import org.apache.cxf.jaxws.JaxWsServerFactoryBean; +import org.apache.cxf.transport.http_jaxws_spi.JAXWSHttpSpiTransportFactory; + +/** + * + */ +public class EndpointImpl extends org.apache.cxf.jaxws.EndpointImpl { + //What really is the point of the EndpointContext in JAX-WS 2.2? + //There is a setter, but no getter. + Object endpointContext; + + /** + * @param implementor + */ + public EndpointImpl(Object implementor) { + super(implementor); + } + + /** + * @param b + * @param implementor + * @param sf + */ + public EndpointImpl(Bus b, Object implementor, JaxWsServerFactoryBean sf) { + super(b, implementor, sf); + } + + /** + * @param b + * @param i + * @param bindingUri + * @param wsdl + */ + public EndpointImpl(Bus b, Object i, String bindingUri, String wsdl) { + super(b, i, bindingUri, wsdl); + } + + /** + * @param b + * @param i + * @param bindingUri + * @param wsdl + * @param f + */ + public EndpointImpl(Bus b, Object i, String bindingUri, String wsdl, WebServiceFeature[] f) { + super(b, i, bindingUri, wsdl, f); + } + + /** + * @param b + * @param i + * @param bindingUri + */ + public EndpointImpl(Bus b, Object i, String bindingUri) { + super(b, i, bindingUri); + } + + /** + * @param b + * @param i + * @param bindingUri + * @param features + */ + public EndpointImpl(Bus b, Object i, String bindingUri, WebServiceFeature[] features) { + super(b, i, bindingUri, features); + } + + /** + * @param bus + * @param implementor + */ + public EndpointImpl(Bus bus, Object implementor) { + super(bus, implementor); + } + + //new in 2.2, but introduces a new class not found in 2.1 + public void setEndpointContext(EndpointContext ctxt) { + endpointContext = ctxt; + } + + //new in 2.2, but introduces a new class not found in 2.1 + public void publish(javax.xml.ws.spi.http.HttpContext context) { + ServerFactoryBean serverFactory = getServerFactory(); + if (serverFactory.getDestinationFactory() == null) { + serverFactory.setDestinationFactory(new JAXWSHttpSpiTransportFactory(context)); + } + super.publish(context.getPath()); + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/JAXWS22Invoker.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/JAXWS22Invoker.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/JAXWS22Invoker.java new file mode 100644 index 0000000..4432ca1 --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/JAXWS22Invoker.java @@ -0,0 +1,43 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.jaxws22; + +import java.lang.reflect.Method; + +import org.apache.cxf.jaxws.JAXWSMethodInvoker; +import org.apache.cxf.message.Exchange; +import org.apache.cxf.service.invoker.Invoker; + +/** + * + */ +public class JAXWS22Invoker extends JAXWSMethodInvoker implements Invoker { + javax.xml.ws.spi.Invoker invoker; + + public JAXWS22Invoker(javax.xml.ws.spi.Invoker inv) { + super(null); + invoker = inv; + } + @Override + protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, + Object[] paramArray) throws Exception { + return invoker.invoke(m, paramArray); + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/spi/ProviderImpl.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/spi/ProviderImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/spi/ProviderImpl.java new file mode 100644 index 0000000..606659c --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/spi/ProviderImpl.java @@ -0,0 +1,76 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.jaxws22.spi; + +import java.util.Arrays; + +import javax.xml.ws.Endpoint; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; +import javax.xml.ws.spi.Invoker; + +import org.apache.cxf.Bus; +import org.apache.cxf.BusFactory; +import org.apache.cxf.common.i18n.Message; +import org.apache.cxf.jaxws.EndpointUtils; +import org.apache.cxf.jaxws.JaxWsServerFactoryBean; +import org.apache.cxf.jaxws.context.WebServiceContextImpl; +import org.apache.cxf.jaxws22.EndpointImpl; +import org.apache.cxf.jaxws22.JAXWS22Invoker; + +public class ProviderImpl extends org.apache.cxf.jaxws.spi.ProviderImpl { + @Override + protected org.apache.cxf.jaxws.EndpointImpl createEndpointImpl(Bus bus, + String bindingId, + Object implementor, + WebServiceFeature ... features) { + if (isJaxWs22()) { + return new EndpointImpl(bus, implementor, bindingId, features); + } + //couldn't find the 2.2 stuff, assume 2.1 behavior + return super.createEndpointImpl(bus, bindingId, implementor, features); + } + + //new in 2.2, but introduces a new class not found in 2.1 + public Endpoint createEndpoint(String bindingId, Class<?> implementorClass, + Invoker invoker, WebServiceFeature ... features) { + if (EndpointUtils.isValidImplementor(implementorClass)) { + Bus bus = BusFactory.getThreadDefaultBus(); + JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); + if (features != null) { + factory.getJaxWsServiceFactory().setWsFeatures(Arrays.asList(features)); + } + if (invoker != null) { + factory.setInvoker(new JAXWS22Invoker(invoker)); + try { + invoker.inject(new WebServiceContextImpl()); + } catch (Exception e) { + throw new WebServiceException(new Message("ENDPOINT_CREATION_FAILED_MSG", + LOG).toString(), e); + } + } + EndpointImpl ep = new EndpointImpl(bus, null, factory); + ep.setImplementorClass(implementorClass); + return ep; + } else { + throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString()); + } + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java new file mode 100644 index 0000000..7b2f7e8 --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.jaxws22.spring; + +import org.apache.cxf.Bus; +import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor; +import org.apache.cxf.common.injection.NoJSR250Annotations; +import org.apache.cxf.jaxws.spring.EndpointDefinitionParser; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +@NoJSR250Annotations +public class JAXWS22SpringEndpointImpl extends org.apache.cxf.jaxws22.EndpointImpl + implements ApplicationContextAware { + + boolean checkBlockConstruct; + + public JAXWS22SpringEndpointImpl(Object o) { + super(o instanceof Bus ? (Bus)o : null, + o instanceof Bus ? null : o); + } + + public JAXWS22SpringEndpointImpl(Bus bus, Object implementor) { + super(bus, implementor); + } + + public void setCheckBlockConstruct(Boolean b) { + checkBlockConstruct = b; + } + + public void setApplicationContext(ApplicationContext ctx) throws BeansException { + if (checkBlockConstruct) { + EndpointDefinitionParser.setBlocking(ctx, this); + } + if (getBus() == null) { + setBus(BusWiringBeanFactoryPostProcessor.addDefaultBus(ctx)); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpHandlerImpl.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpHandlerImpl.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpHandlerImpl.java new file mode 100644 index 0000000..4009d61 --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpHandlerImpl.java @@ -0,0 +1,71 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.transport.http_jaxws_spi; + +import java.io.IOException; + +import javax.xml.ws.spi.http.HttpExchange; +import javax.xml.ws.spi.http.HttpHandler; + +import org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress; +import org.apache.cxf.service.model.EndpointInfo; +import org.apache.cxf.wsdl.http.AddressType; + +/** + * A javax.xml.ws.spi.http.HttpHandler implementation that uses + * a JAXWSHttpSpiDestination instance for message processing + */ +public class HttpHandlerImpl extends HttpHandler { + + private JAXWSHttpSpiDestination destination; + + public HttpHandlerImpl(JAXWSHttpSpiDestination destination) { + this.destination = destination; + } + + @Override + public void handle(HttpExchange exchange) throws IOException { + try { + //Update address in EndpointInfo; this can only happen here, + //as the contextPath is provided in the HttpExchange only + EndpointInfo ei = destination.getEndpointInfo(); + if (ei != null) { + String ad = ei.getAddress(); + String path = exchange.getHttpContext().getPath(); + if (ad != null && ad.equals(path)) { + synchronized (ei) { + String contextPath = exchange.getContextPath(); + ei.setAddress(contextPath + path); + if (ei.getExtensor(AddressType.class) != null) { + ei.getExtensor(AddressType.class).setLocation(contextPath + path); + } else if (ei.getExtensor(SoapAddress.class) != null) { + ei.getExtensor(SoapAddress.class).setLocationURI(contextPath + path); + } + } + } + } + //service request + destination.doService(new HttpServletRequestAdapter(exchange), + new HttpServletResponseAdapter(exchange)); + } finally { + exchange.close(); + } + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java new file mode 100644 index 0000000..0797b5e --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java @@ -0,0 +1,414 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.transport.http_jaxws_spi; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UnsupportedEncodingException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.security.Principal; +import java.util.Collection; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.AsyncContext; +import javax.servlet.DispatcherType; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.http.Part; +import javax.xml.ws.spi.http.HttpContext; +import javax.xml.ws.spi.http.HttpExchange; + +/** + * This class provides a HttpServletRequest instance using information + * coming from the HttpExchange and HttpContext instances provided + * by the underlying container. + * Note: many methods' implementation still TODO. + * + */ +class HttpServletRequestAdapter implements HttpServletRequest { + + private HttpExchange exchange; + private HttpContext context; + private String characterEncoding; + private ServletInputStreamAdapter servletInputStreamAdapter; + private BufferedReader reader; + + public HttpServletRequestAdapter(HttpExchange exchange) { + this.exchange = exchange; + this.context = exchange.getHttpContext(); + } + + public AsyncContext getAsyncContext() { + throw new UnsupportedOperationException(); + } + + public Object getAttribute(String name) { + return exchange.getAttribute(name); + } + + public Enumeration<String> getAttributeNames() { + return Collections.enumeration(exchange.getAttributeNames()); + } + + public String getCharacterEncoding() { + return characterEncoding; + } + + public int getContentLength() { + return 0; + } + + public String getContentType() { + return this.getHeader("Content-Type"); + } + + public DispatcherType getDispatcherType() { + throw new UnsupportedOperationException(); + } + + public ServletInputStream getInputStream() throws IOException { + if (servletInputStreamAdapter == null) { + servletInputStreamAdapter = new ServletInputStreamAdapter(exchange.getRequestBody()); + } + return servletInputStreamAdapter; + } + + public String getLocalAddr() { + InetSocketAddress isa = exchange.getLocalAddress(); + if (isa != null) { + InetAddress ia = isa.getAddress(); + if (ia != null) { + return ia.getHostAddress(); + } + } + return null; + } + + public Locale getLocale() { + return null; + } + + public Enumeration<Locale> getLocales() { + throw new UnsupportedOperationException(); + } + + public String getLocalName() { + InetSocketAddress isa = exchange.getLocalAddress(); + if (isa != null) { + InetAddress ia = isa.getAddress(); + if (ia != null) { + return ia.getHostName(); + } + } + return null; + } + + public int getLocalPort() { + InetSocketAddress isa = exchange.getLocalAddress(); + return isa != null ? isa.getPort() : 0; + } + + public String getParameter(String name) { + throw new UnsupportedOperationException(); + } + + public Map<String, String[]> getParameterMap() { + throw new UnsupportedOperationException(); + } + + public Enumeration<String> getParameterNames() { + throw new UnsupportedOperationException(); + } + + public String[] getParameterValues(String name) { + throw new UnsupportedOperationException(); + } + + public String getProtocol() { + return exchange.getProtocol(); + } + + public BufferedReader getReader() throws IOException { + if (reader == null) { + Reader isr = characterEncoding == null + ? new InputStreamReader(exchange.getRequestBody()) + : new InputStreamReader(exchange.getRequestBody(), characterEncoding); + reader = new BufferedReader(isr); + } + return reader; + } + + @Deprecated + public String getRealPath(String path) { + throw new UnsupportedOperationException(); + } + + public String getRemoteAddr() { + InetSocketAddress isa = exchange.getRemoteAddress(); + if (isa != null) { + InetAddress ia = isa.getAddress(); + if (ia != null) { + return ia.getHostAddress(); + } + } + return null; + } + + public String getRemoteHost() { + InetSocketAddress isa = exchange.getRemoteAddress(); + if (isa != null) { + InetAddress ia = isa.getAddress(); + if (ia != null) { + return ia.getHostName(); + } + } + return null; + } + + public int getRemotePort() { + InetSocketAddress isa = exchange.getRemoteAddress(); + return isa != null ? isa.getPort() : 0; + } + + public RequestDispatcher getRequestDispatcher(String path) { + throw new UnsupportedOperationException(); + } + + public String getScheme() { + return exchange.getScheme(); + } + + public String getServerName() { + return null; + } + + public int getServerPort() { + return 0; + } + + public ServletContext getServletContext() { + return null; + } + + public boolean isAsyncStarted() { + throw new UnsupportedOperationException(); + } + + public boolean isAsyncSupported() { + throw new UnsupportedOperationException(); + } + + public boolean isSecure() { + throw new UnsupportedOperationException(); + } + + public void removeAttribute(String name) { + throw new UnsupportedOperationException(); + } + + public void setAttribute(String name, Object o) { + throw new UnsupportedOperationException(); + } + + public void setCharacterEncoding(String env) throws UnsupportedEncodingException { + this.characterEncoding = env; + } + + public AsyncContext startAsync() { + throw new UnsupportedOperationException(); + } + + public AsyncContext startAsync(ServletRequest request, ServletResponse response) { + throw new UnsupportedOperationException(); + } + + public boolean authenticate(HttpServletResponse response) throws IOException, ServletException { + throw new UnsupportedOperationException(); + } + + public String getAuthType() { + return null; + } + + public String getContextPath() { + return exchange.getContextPath(); + } + + public Cookie[] getCookies() { + return null; + } + + public long getDateHeader(String name) { + String s = this.getHeader(name); + return s != null ? Long.valueOf(s) : 0; + } + + public String getHeader(String name) { + return exchange.getRequestHeader(name); + } + + public Enumeration<String> getHeaderNames() { + return Collections.enumeration(exchange.getRequestHeaders().keySet()); + } + + public Enumeration<String> getHeaders(String name) { + List<String> list = exchange.getRequestHeaders().get(name); + return list != null ? Collections.enumeration(list) : null; + } + + public int getIntHeader(String name) { + String s = this.getHeader(name); + return s != null ? Integer.valueOf(s) : 0; + } + + public String getMethod() { + return exchange.getRequestMethod(); + } + + public Part getPart(String name) throws IOException, ServletException { + throw new UnsupportedOperationException(); + } + + public Collection<Part> getParts() throws IOException, ServletException { + throw new UnsupportedOperationException(); + } + + public String getPathInfo() { + return exchange.getPathInfo(); + } + + public String getPathTranslated() { + return null; + } + + public String getQueryString() { + return exchange.getQueryString(); + } + + public String getRemoteUser() { + return null; + } + + public String getRequestedSessionId() { + return null; + } + + public String getRequestURI() { + return exchange.getRequestURI(); + } + + public StringBuffer getRequestURL() { + StringBuffer sb = new StringBuffer(); + sb.append(exchange.getScheme()); + sb.append("://"); + String host = this.getHeader("Host"); + if (host != null) { + sb.append(host); + } else { + InetSocketAddress la = exchange.getLocalAddress(); + if (la != null) { + sb.append(la.getHostName()); + if (la.getPort() > 0) { + sb.append(":"); + sb.append(la.getPort()); + } + } else { + sb.append("localhost"); + } + } + sb.append(exchange.getContextPath()); + sb.append(context.getPath()); + return sb; + } + + public String getServletPath() { + return null; + } + + public HttpSession getSession() { + return null; + } + + public HttpSession getSession(boolean create) { + return null; + } + + public Principal getUserPrincipal() { + return exchange.getUserPrincipal(); + } + + public boolean isRequestedSessionIdFromCookie() { + throw new UnsupportedOperationException(); + } + + @Deprecated + public boolean isRequestedSessionIdFromUrl() { + throw new UnsupportedOperationException(); + } + + public boolean isRequestedSessionIdFromURL() { + throw new UnsupportedOperationException(); + } + + public boolean isRequestedSessionIdValid() { + return false; + } + + public boolean isUserInRole(String role) { + return exchange.isUserInRole(role); + } + + public void login(String username, String password) throws ServletException { + throw new UnsupportedOperationException(); + } + + public void logout() throws ServletException { + throw new UnsupportedOperationException(); + } + + private class ServletInputStreamAdapter extends ServletInputStream { + + private InputStream delegate; + + public ServletInputStreamAdapter(InputStream delegate) { + this.delegate = delegate; + } + + @Override + public int read() throws IOException { + return delegate.read(); + } + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpServletResponseAdapter.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpServletResponseAdapter.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpServletResponseAdapter.java new file mode 100644 index 0000000..9e9a329 --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/HttpServletResponseAdapter.java @@ -0,0 +1,245 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.transport.http_jaxws_spi; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; +import javax.xml.ws.spi.http.HttpExchange; + +/** + * This class provides a HttpServletResponse instance using information + * coming from the HttpExchange instance provided + * by the underlying container. + * Note: many methods' implementation still TODO. + * + */ +class HttpServletResponseAdapter implements HttpServletResponse { + + private HttpExchange exchange; + private String characterEncoding; + private Locale locale; + private boolean committed; + private ServletOutputStreamAdapter servletOutputStream; + private PrintWriter writer; + private int status; + + public HttpServletResponseAdapter(HttpExchange exchange) { + this.exchange = exchange; + } + + public void flushBuffer() throws IOException { + exchange.getResponseBody().flush(); + committed = true; + } + + public int getBufferSize() { + throw new UnsupportedOperationException(); + } + + public String getCharacterEncoding() { + return characterEncoding; + } + + public String getContentType() { + return this.getHeader("Content-Type"); + } + + public Locale getLocale() { + return locale; + } + + public ServletOutputStream getOutputStream() throws IOException { + if (servletOutputStream == null) { + servletOutputStream = new ServletOutputStreamAdapter(exchange.getResponseBody()); + } + return servletOutputStream; + } + + public PrintWriter getWriter() throws IOException { + if (writer == null) { + if (characterEncoding != null) { + writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(exchange.getResponseBody(), + characterEncoding))); + } else { + writer = new PrintWriter(exchange.getResponseBody()); + } + } + return writer; + } + + public boolean isCommitted() { + return committed; + } + + public void reset() { + throw new UnsupportedOperationException(); + } + + public void resetBuffer() { + throw new UnsupportedOperationException(); + } + + public void setBufferSize(int size) { + throw new UnsupportedOperationException(); + } + + public void setCharacterEncoding(String charset) { + this.characterEncoding = charset; + } + + public void setContentLength(int len) { + if (!committed) { + exchange.getResponseHeaders().put("Content-Length", + Collections.singletonList(String.valueOf(len))); + } + } + + public void setContentType(String type) { + if (!committed) { + exchange.getResponseHeaders().put("Content-Type", Collections.singletonList(type)); + } + } + + public void setLocale(Locale loc) { + this.locale = loc; + } + + public void addCookie(Cookie cookie) { + throw new UnsupportedOperationException(); + } + + public void addDateHeader(String name, long date) { + this.addHeader(name, String.valueOf(date)); + } + + public void addHeader(String name, String value) { + exchange.addResponseHeader(name, value); + } + + public void addIntHeader(String name, int value) { + this.addHeader(name, String.valueOf(value)); + } + + public boolean containsHeader(String name) { + return exchange.getResponseHeaders().containsKey(name); + } + + public String encodeURL(String url) { + throw new UnsupportedOperationException(); + } + + public String encodeRedirectURL(String url) { + throw new UnsupportedOperationException(); + } + + @Deprecated + public String encodeUrl(String url) { + throw new UnsupportedOperationException(); + } + + @Deprecated + public String encodeRedirectUrl(String url) { + throw new UnsupportedOperationException(); + } + + public String getHeader(String name) { + List<String> headers = exchange.getResponseHeaders().get(name); + return (headers != null && !headers.isEmpty()) ? headers.get(0) : null; + } + + public Collection<String> getHeaderNames() { + return exchange.getResponseHeaders().keySet(); + } + + public Collection<String> getHeaders(String headerName) { + return exchange.getResponseHeaders().get(headerName); + } + + public int getStatus() { + return status; + } + + public void sendError(int sc) throws IOException { + this.setStatus(sc); + this.committed = true; + } + + public void sendError(int sc, String msg) throws IOException { + this.sendError(sc); + } + + public void sendRedirect(String location) throws IOException { + throw new UnsupportedOperationException(); + } + + public void setDateHeader(String name, long date) { + this.setHeader(name, String.valueOf(date)); + } + + public void setHeader(String name, String value) { + List<String> list = new LinkedList<String>(); + list.add(value); + exchange.getResponseHeaders().put(name, list); + } + + public void setIntHeader(String name, int value) { + this.setHeader(name, String.valueOf(value)); + } + + public void setStatus(int sc) { + this.status = sc; + this.exchange.setStatus(sc); + } + + @Deprecated + public void setStatus(int sc, String sm) { + this.setStatus(sc); + } + + private class ServletOutputStreamAdapter extends ServletOutputStream { + + private OutputStream delegate; + + public ServletOutputStreamAdapter(OutputStream delegate) { + this.delegate = delegate; + } + + @Override + public void write(int b) throws IOException { + delegate.write(b); + } + + @Override + public void flush() throws IOException { + delegate.flush(); + } + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java new file mode 100644 index 0000000..8553082 --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestination.java @@ -0,0 +1,123 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.transport.http_jaxws_spi; + +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.cxf.Bus; +import org.apache.cxf.BusFactory; +import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.continuations.SuspendedInvocationException; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.ExchangeImpl; +import org.apache.cxf.message.Message; +import org.apache.cxf.message.MessageImpl; +import org.apache.cxf.service.model.EndpointInfo; +import org.apache.cxf.transport.http.AbstractHTTPDestination; +import org.apache.cxf.transport.http.DestinationRegistry; +import org.apache.cxf.transport.http.HTTPSession; + +public class JAXWSHttpSpiDestination extends AbstractHTTPDestination { + + static final Logger LOG = LogUtils.getL7dLogger(JAXWSHttpSpiDestination.class); + + public JAXWSHttpSpiDestination(Bus b, + DestinationRegistry registry, + EndpointInfo ei) throws IOException { + super(b, registry, ei, ei.getAddress(), false); + } + + @Override + protected Logger getLogger() { + return LOG; + } + + /** + * This is called by handlers for servicing requests + * + * @param context + * @param req + * @param resp + * @throws IOException + */ + protected void doService(HttpServletRequest req, HttpServletResponse resp) + throws IOException { + + Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus); + try { + serviceRequest(req, resp); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (origBus != bus) { + BusFactory.setThreadDefaultBus(origBus); + } + } + } + + protected void serviceRequest(final HttpServletRequest req, final HttpServletResponse resp) + throws IOException { + + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Service http request on thread: " + Thread.currentThread()); + } + Message inMessage = new MessageImpl(); + ExchangeImpl exchange = new ExchangeImpl(); + exchange.setInMessage(inMessage); + + setupMessage(inMessage, null, req.getServletContext(), req, resp); + + ((MessageImpl)inMessage).setDestination(this); + + exchange.setSession(new HTTPSession(req)); + + try { + incomingObserver.onMessage(inMessage); + resp.flushBuffer(); + } catch (SuspendedInvocationException ex) { + if (ex.getRuntimeException() != null) { + throw ex.getRuntimeException(); + } + // else nothing to do + } catch (Fault ex) { + Throwable cause = ex.getCause(); + if (cause instanceof RuntimeException) { + throw (RuntimeException)cause; + } else { + throw ex; + } + } catch (RuntimeException ex) { + throw ex; + } finally { + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Finished servicing http request on thread: " + Thread.currentThread()); + } + } + } + + protected String getBasePath(String contextPath) throws IOException { + return contextPath + getAddress().getAddress().getValue(); + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiTransportFactory.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiTransportFactory.java b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiTransportFactory.java new file mode 100644 index 0000000..e137220 --- /dev/null +++ b/rt/frontend/jaxws/src/main/java/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiTransportFactory.java @@ -0,0 +1,52 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.transport.http_jaxws_spi; + +import java.io.IOException; + +import javax.xml.ws.spi.http.HttpContext; + +import org.apache.cxf.Bus; +import org.apache.cxf.binding.soap.SoapTransportFactory; +import org.apache.cxf.service.model.EndpointInfo; +import org.apache.cxf.transport.Destination; +import org.apache.cxf.transport.DestinationFactory; +import org.apache.cxf.transport.http.DestinationRegistryImpl; + +public class JAXWSHttpSpiTransportFactory extends SoapTransportFactory implements DestinationFactory { + + private HttpContext context; + private JAXWSHttpSpiDestination destination; + + public JAXWSHttpSpiTransportFactory(HttpContext context) { + super(); + this.context = context; + } + + public Destination getDestination(EndpointInfo endpointInfo, Bus bus) throws IOException { + if (destination == null) { + destination = new JAXWSHttpSpiDestination(bus, new DestinationRegistryImpl(), endpointInfo); + // set handler into the provided HttpContext, our Destination hook into the server container + HttpHandlerImpl handler = new HttpHandlerImpl(destination); + context.setHandler(handler); + } + return destination; + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/EndpointImpl.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/EndpointImpl.java b/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/EndpointImpl.java deleted file mode 100644 index 7c38466..0000000 --- a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/EndpointImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.cxf.jaxws22; - -import javax.xml.ws.EndpointContext; -import javax.xml.ws.WebServiceFeature; - -import org.apache.cxf.Bus; -import org.apache.cxf.frontend.ServerFactoryBean; -import org.apache.cxf.jaxws.JaxWsServerFactoryBean; -import org.apache.cxf.transport.http_jaxws_spi.JAXWSHttpSpiTransportFactory; - -/** - * - */ -public class EndpointImpl extends org.apache.cxf.jaxws.EndpointImpl { - //What really is the point of the EndpointContext in JAX-WS 2.2? - //There is a setter, but no getter. - Object endpointContext; - - /** - * @param implementor - */ - public EndpointImpl(Object implementor) { - super(implementor); - } - - /** - * @param b - * @param implementor - * @param sf - */ - public EndpointImpl(Bus b, Object implementor, JaxWsServerFactoryBean sf) { - super(b, implementor, sf); - } - - /** - * @param b - * @param i - * @param bindingUri - * @param wsdl - */ - public EndpointImpl(Bus b, Object i, String bindingUri, String wsdl) { - super(b, i, bindingUri, wsdl); - } - - /** - * @param b - * @param i - * @param bindingUri - * @param wsdl - * @param f - */ - public EndpointImpl(Bus b, Object i, String bindingUri, String wsdl, WebServiceFeature[] f) { - super(b, i, bindingUri, wsdl, f); - } - - /** - * @param b - * @param i - * @param bindingUri - */ - public EndpointImpl(Bus b, Object i, String bindingUri) { - super(b, i, bindingUri); - } - - /** - * @param b - * @param i - * @param bindingUri - * @param features - */ - public EndpointImpl(Bus b, Object i, String bindingUri, WebServiceFeature[] features) { - super(b, i, bindingUri, features); - } - - /** - * @param bus - * @param implementor - */ - public EndpointImpl(Bus bus, Object implementor) { - super(bus, implementor); - } - - //new in 2.2, but introduces a new class not found in 2.1 - public void setEndpointContext(EndpointContext ctxt) { - endpointContext = ctxt; - } - - //new in 2.2, but introduces a new class not found in 2.1 - public void publish(javax.xml.ws.spi.http.HttpContext context) { - ServerFactoryBean serverFactory = getServerFactory(); - if (serverFactory.getDestinationFactory() == null) { - serverFactory.setDestinationFactory(new JAXWSHttpSpiTransportFactory(context)); - } - super.publish(context.getPath()); - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/JAXWS22Invoker.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/JAXWS22Invoker.java b/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/JAXWS22Invoker.java deleted file mode 100644 index 4432ca1..0000000 --- a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/JAXWS22Invoker.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.cxf.jaxws22; - -import java.lang.reflect.Method; - -import org.apache.cxf.jaxws.JAXWSMethodInvoker; -import org.apache.cxf.message.Exchange; -import org.apache.cxf.service.invoker.Invoker; - -/** - * - */ -public class JAXWS22Invoker extends JAXWSMethodInvoker implements Invoker { - javax.xml.ws.spi.Invoker invoker; - - public JAXWS22Invoker(javax.xml.ws.spi.Invoker inv) { - super(null); - invoker = inv; - } - @Override - protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, - Object[] paramArray) throws Exception { - return invoker.invoke(m, paramArray); - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java b/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java deleted file mode 100644 index 606659c..0000000 --- a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spi/ProviderImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.cxf.jaxws22.spi; - -import java.util.Arrays; - -import javax.xml.ws.Endpoint; -import javax.xml.ws.WebServiceException; -import javax.xml.ws.WebServiceFeature; -import javax.xml.ws.spi.Invoker; - -import org.apache.cxf.Bus; -import org.apache.cxf.BusFactory; -import org.apache.cxf.common.i18n.Message; -import org.apache.cxf.jaxws.EndpointUtils; -import org.apache.cxf.jaxws.JaxWsServerFactoryBean; -import org.apache.cxf.jaxws.context.WebServiceContextImpl; -import org.apache.cxf.jaxws22.EndpointImpl; -import org.apache.cxf.jaxws22.JAXWS22Invoker; - -public class ProviderImpl extends org.apache.cxf.jaxws.spi.ProviderImpl { - @Override - protected org.apache.cxf.jaxws.EndpointImpl createEndpointImpl(Bus bus, - String bindingId, - Object implementor, - WebServiceFeature ... features) { - if (isJaxWs22()) { - return new EndpointImpl(bus, implementor, bindingId, features); - } - //couldn't find the 2.2 stuff, assume 2.1 behavior - return super.createEndpointImpl(bus, bindingId, implementor, features); - } - - //new in 2.2, but introduces a new class not found in 2.1 - public Endpoint createEndpoint(String bindingId, Class<?> implementorClass, - Invoker invoker, WebServiceFeature ... features) { - if (EndpointUtils.isValidImplementor(implementorClass)) { - Bus bus = BusFactory.getThreadDefaultBus(); - JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); - if (features != null) { - factory.getJaxWsServiceFactory().setWsFeatures(Arrays.asList(features)); - } - if (invoker != null) { - factory.setInvoker(new JAXWS22Invoker(invoker)); - try { - invoker.inject(new WebServiceContextImpl()); - } catch (Exception e) { - throw new WebServiceException(new Message("ENDPOINT_CREATION_FAILED_MSG", - LOG).toString(), e); - } - } - EndpointImpl ep = new EndpointImpl(bus, null, factory); - ep.setImplementorClass(implementorClass); - return ep; - } else { - throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString()); - } - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java b/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java deleted file mode 100644 index 7b2f7e8..0000000 --- a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/jaxws22/spring/JAXWS22SpringEndpointImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.jaxws22.spring; - -import org.apache.cxf.Bus; -import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor; -import org.apache.cxf.common.injection.NoJSR250Annotations; -import org.apache.cxf.jaxws.spring.EndpointDefinitionParser; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -@NoJSR250Annotations -public class JAXWS22SpringEndpointImpl extends org.apache.cxf.jaxws22.EndpointImpl - implements ApplicationContextAware { - - boolean checkBlockConstruct; - - public JAXWS22SpringEndpointImpl(Object o) { - super(o instanceof Bus ? (Bus)o : null, - o instanceof Bus ? null : o); - } - - public JAXWS22SpringEndpointImpl(Bus bus, Object implementor) { - super(bus, implementor); - } - - public void setCheckBlockConstruct(Boolean b) { - checkBlockConstruct = b; - } - - public void setApplicationContext(ApplicationContext ctx) throws BeansException { - if (checkBlockConstruct) { - EndpointDefinitionParser.setBlocking(ctx, this); - } - if (getBus() == null) { - setBus(BusWiringBeanFactoryPostProcessor.addDefaultBus(ctx)); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf/blob/67432aef/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpHandlerImpl.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpHandlerImpl.java b/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpHandlerImpl.java deleted file mode 100644 index 4009d61..0000000 --- a/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpHandlerImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.transport.http_jaxws_spi; - -import java.io.IOException; - -import javax.xml.ws.spi.http.HttpExchange; -import javax.xml.ws.spi.http.HttpHandler; - -import org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress; -import org.apache.cxf.service.model.EndpointInfo; -import org.apache.cxf.wsdl.http.AddressType; - -/** - * A javax.xml.ws.spi.http.HttpHandler implementation that uses - * a JAXWSHttpSpiDestination instance for message processing - */ -public class HttpHandlerImpl extends HttpHandler { - - private JAXWSHttpSpiDestination destination; - - public HttpHandlerImpl(JAXWSHttpSpiDestination destination) { - this.destination = destination; - } - - @Override - public void handle(HttpExchange exchange) throws IOException { - try { - //Update address in EndpointInfo; this can only happen here, - //as the contextPath is provided in the HttpExchange only - EndpointInfo ei = destination.getEndpointInfo(); - if (ei != null) { - String ad = ei.getAddress(); - String path = exchange.getHttpContext().getPath(); - if (ad != null && ad.equals(path)) { - synchronized (ei) { - String contextPath = exchange.getContextPath(); - ei.setAddress(contextPath + path); - if (ei.getExtensor(AddressType.class) != null) { - ei.getExtensor(AddressType.class).setLocation(contextPath + path); - } else if (ei.getExtensor(SoapAddress.class) != null) { - ei.getExtensor(SoapAddress.class).setLocationURI(contextPath + path); - } - } - } - } - //service request - destination.doService(new HttpServletRequestAdapter(exchange), - new HttpServletResponseAdapter(exchange)); - } finally { - exchange.close(); - } - } - -}
