You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/04/19 13:38:37 UTC
[cxf] 06/09: More work on the samples
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 8a1adaeb07799a077153cd67fd4ec4769fe8b16a
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Thu Apr 19 11:46:28 2018 +0100
More work on the samples
---
.../src/main/java/demo/callback/server/Server.java | 4 +-
.../src/main/resources/callback_infoset.xml | 18 +++++++++
.../samples/configuration_interceptor/pom.xml | 7 ----
.../src/main/java/demo/stream/client/Client.java | 11 ++++-
.../src/main/java/demo/stream/server/Server.java | 9 ++++-
.../src/main/resources/client.xml | 40 ------------------
.../src/main/resources/server.xml | 47 ----------------------
7 files changed, 38 insertions(+), 98 deletions(-)
diff --git a/distribution/src/main/release/samples/callback/src/main/java/demo/callback/server/Server.java b/distribution/src/main/release/samples/callback/src/main/java/demo/callback/server/Server.java
index b6e793f..620e345 100644
--- a/distribution/src/main/release/samples/callback/src/main/java/demo/callback/server/Server.java
+++ b/distribution/src/main/release/samples/callback/src/main/java/demo/callback/server/Server.java
@@ -22,13 +22,15 @@ package demo.callback.server;
import javax.xml.ws.Endpoint;
+import org.apache.cxf.ext.logging.LoggingFeature;
+
public class Server {
protected Server() throws Exception {
System.out.println("Starting Server");
Object implementor = new ServerImpl();
String address = "http://localhost:9000/SoapContext/SoapPort";
- Endpoint.publish(address, implementor);
+ Endpoint.publish(address, implementor, new LoggingFeature());
}
public static void main(String args[]) throws Exception {
diff --git a/distribution/src/main/release/samples/callback/src/main/resources/callback_infoset.xml b/distribution/src/main/release/samples/callback/src/main/resources/callback_infoset.xml
index 6defc59..eea7e4d 100644
--- a/distribution/src/main/release/samples/callback/src/main/resources/callback_infoset.xml
+++ b/distribution/src/main/release/samples/callback/src/main/resources/callback_infoset.xml
@@ -1,4 +1,22 @@
<?xml version="1.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.
+-->
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Address>http://localhost:9005/CallbackContext/CallbackPort</wsa:Address>
<wsa:ReferenceProperties/>
diff --git a/distribution/src/main/release/samples/configuration_interceptor/pom.xml b/distribution/src/main/release/samples/configuration_interceptor/pom.xml
index 4b221b5..e0939ae 100644
--- a/distribution/src/main/release/samples/configuration_interceptor/pom.xml
+++ b/distribution/src/main/release/samples/configuration_interceptor/pom.xml
@@ -74,7 +74,6 @@
<configuration>
<executable>java</executable>
<arguments>
- <argument>-Dcxf.config.file=${project.build.directory}/classes/server.xml</argument>
<argument>-classpath</argument>
<classpath />
<argument>demo.stream.server.Server</argument>
@@ -103,7 +102,6 @@
<configuration>
<executable>java</executable>
<arguments>
- <argument>-Dcxf.config.file=${project.build.directory}/classes/client.xml</argument>
<argument>-classpath</argument>
<classpath />
<argument>demo.stream.client.Client</argument>
@@ -132,10 +130,5 @@
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.2.5-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-management</artifactId>
- <version>3.2.5-SNAPSHOT</version>
- </dependency>
</dependencies>
</project>
diff --git a/distribution/src/main/release/samples/configuration_interceptor/src/main/java/demo/stream/client/Client.java b/distribution/src/main/release/samples/configuration_interceptor/src/main/java/demo/stream/client/Client.java
index 709f2e3..74304fa 100644
--- a/distribution/src/main/release/samples/configuration_interceptor/src/main/java/demo/stream/client/Client.java
+++ b/distribution/src/main/release/samples/configuration_interceptor/src/main/java/demo/stream/client/Client.java
@@ -21,9 +21,13 @@ package demo.stream.client;
import java.net.URL;
import javax.xml.namespace.QName;
+
+import org.apache.cxf.frontend.ClientProxy;
import org.apache.hello_world_soap_http.Greeter;
import org.apache.hello_world_soap_http.SOAPService;
+import demo.stream.interceptor.StreamInterceptor;
+
public final class Client {
@@ -39,10 +43,13 @@ public final class Client {
URL wsdlURL = Client.class.getResource("/wsdl/hello_world.wsdl");
SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
Greeter port = ss.getSoapPort();
- String resp;
+
+ org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
+ client.getInInterceptors().add(new StreamInterceptor());
+ client.getInFaultInterceptors().add(new StreamInterceptor());
System.out.println("Invoking sayHi...");
- resp = port.sayHi();
+ String resp = port.sayHi();
System.out.println("Server responded with: " + resp);
System.out.println();
diff --git a/distribution/src/main/release/samples/configuration_interceptor/src/main/java/demo/stream/server/Server.java b/distribution/src/main/release/samples/configuration_interceptor/src/main/java/demo/stream/server/Server.java
index bcd1727..b7a2b93 100644
--- a/distribution/src/main/release/samples/configuration_interceptor/src/main/java/demo/stream/server/Server.java
+++ b/distribution/src/main/release/samples/configuration_interceptor/src/main/java/demo/stream/server/Server.java
@@ -21,6 +21,11 @@ package demo.stream.server;
import javax.xml.ws.Endpoint;
+import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.jaxws.EndpointImpl;
+
+import demo.stream.interceptor.StreamInterceptor;
+
public class Server {
protected Server() throws Exception {
@@ -28,7 +33,9 @@ public class Server {
Object implementor = new GreeterImpl();
String address = "http://localhost:9000/SoapContext/SoapPort";
- Endpoint.publish(address, implementor);
+ EndpointImpl ep = (EndpointImpl)Endpoint.publish(address, implementor, new LoggingFeature());
+
+ ep.getOutInterceptors().add(new StreamInterceptor());
}
public static void main(String args[]) throws Exception {
diff --git a/distribution/src/main/release/samples/configuration_interceptor/src/main/resources/client.xml b/distribution/src/main/release/samples/configuration_interceptor/src/main/resources/client.xml
deleted file mode 100644
index 19a5287..0000000
--- a/distribution/src/main/release/samples/configuration_interceptor/src/main/resources/client.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/core" xmlns:http="http://cxf.apache.org/transports/http/configuration" xsi:schemaLocation=" http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://www.springframework.org/schema/beans http://www.sp [...]
- <http:conduit name="{http://apache.org/hello_world_soap_http}SoapPort9001.http-conduit">
- <http:client DecoupledEndpoint="http://localhost:9990/decoupled_endpoint"/>
- </http:conduit>
- <bean id="GZIPStream" class="demo.stream.interceptor.StreamInterceptor"/>
- <!-- We are adding the interceptors to the bus as we will have only one endpoint/service/bus. -->
- <cxf:bus>
- <cxf:inInterceptors>
- <ref bean="GZIPStream"/>
- </cxf:inInterceptors>
- <cxf:inFaultInterceptors>
- <ref bean="GZIPStream"/>
- </cxf:inFaultInterceptors>
- <!--cxf:outInterceptors>
- <ref bean="GZIPStream"/>
- </cxf:outInterceptors>
- <cxf:outFaultInterceptors>
- <ref bean="GZIPStream"/>
- </cxf:outFaultInterceptors-->
- </cxf:bus>
-</beans>
diff --git a/distribution/src/main/release/samples/configuration_interceptor/src/main/resources/server.xml b/distribution/src/main/release/samples/configuration_interceptor/src/main/resources/server.xml
deleted file mode 100644
index e8530c7..0000000
--- a/distribution/src/main/release/samples/configuration_interceptor/src/main/resources/server.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/core" xsi:schemaLocation=" http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
- <bean id="GZIPStream" class="demo.stream.interceptor.StreamInterceptor"/>
- <!-- We are adding the interceptors to the bus as we will have only one endpoint/service/bus. -->
- <cxf:bus>
- <!--cxf:inInterceptors>
- <ref bean="GZIPStream"/>
- </cxf:inInterceptors>
- <cxf:inFaultInterceptors>
- <ref bean="GZIPStream"/>
- </cxf:inFaultInterceptors-->
- <cxf:outInterceptors>
- <ref bean="GZIPStream"/>
- </cxf:outInterceptors>
- <!--cxf:outFaultInterceptors>
- <ref bean="GZIPStream"/>
- </cxf:outFaultInterceptors-->
- </cxf:bus>
- <bean id="org.apache.cxf.management.InstrumentationManager" class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
- <property name="bus" ref="cxf"/>
- <property name="enabled" value="true"/>
- <property name="threaded" value="false"/>
- <property name="daemon" value="false"/>
- <property name="JMXServiceURL" value="service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi"/>
- </bean>
- <bean id="org.apache.cxf.management.counters.CounterRepository" class="org.apache.cxf.management.counters.CounterRepository">
- <property name="bus" ref="cxf"/>
- </bean>
-</beans>
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.