cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gma...@apache.org
Subject svn commit: r1208005 - in /cxf/trunk/distribution/src/main/release/samples/java_first_spring_support: ./ src/main/java/demo/spring/ src/main/java/demo/spring/client/ src/main/java/demo/spring/service/ src/main/java/demo/spring/servlet/ src/main/resourc...
Date Tue, 29 Nov 2011 18:22:00 GMT
Author: gmazza
Date: Tue Nov 29 18:21:59 2011
New Revision: 1208005

URL: http://svn.apache.org/viewvc?rev=1208005&view=rev
Log:
Better Mavenized java_first_spring_support example.

Added:
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorld.java
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorldImpl.java
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/Server.java
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/resources/
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/resources/client-beans.xml
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/webapp/
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/webapp/WEB-INF/
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
  (with props)
Removed:
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/HelloWorld.java
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/HelloWorldImpl.java
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/client/client-beans.xml
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/servlet/
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/webapp/
Modified:
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/pom.xml
    cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/client/Client.java

Modified: cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/pom.xml?rev=1208005&r1=1208004&r2=1208005&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/pom.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/pom.xml Tue
Nov 29 18:21:59 2011
@@ -20,9 +20,10 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.cxf.samples</groupId>
     <artifactId>java_first_spring_support</artifactId>
+    <version>2.5.1-SNAPSHOT</version>
     <name>Spring HTTP Sample</name>
     <description>Spring HTTP Sample</description>
-    <version>2.5.1-SNAPSHOT</version>
+    <packaging>war</packaging>
 
     <parent>
         <groupId>org.apache.cxf.samples</groupId>
@@ -31,34 +32,19 @@
     </parent>
     <properties>
         <cxf.version>${project.version}</cxf.version>
+        <cxf.release.base>${basedir}/../..</cxf.release.base>
     </properties>
     <build>
         <plugins>
             <plugin>
-                <artifactId>maven-compiler-plugin</artifactId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>2.1</version>
                 <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
+                    <webXml>${cxf.release.base}/etc/web.xml</webXml>
                 </configuration>
             </plugin>
-            <plugin>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>prepare-transform</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <configuration>
-                            <tasks>
-                                <copy file="${basedir}/src/main/java/demo/spring/client/client-beans.xml"
todir="${basedir}/target/classes/demo/spring/client" />
-                            </tasks>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
+        <finalName>JavaFirstSpringSupport</finalName>
     </build>
     <profiles>
         <profile>
@@ -76,7 +62,7 @@
                                     <goal>java</goal>
                                 </goals>
                                 <configuration>
-                                    <mainClass>demo.spring.servlet.Server</mainClass>
+                                    <mainClass>demo.spring.service.Server</mainClass>
                                 </configuration>
                             </execution>
                         </executions>
@@ -119,7 +105,6 @@
             <artifactId>cxf-rt-transports-http</artifactId>
             <version>2.5.1-SNAPSHOT</version>
         </dependency>
-        <!-- Jetty is needed if you're not using the CXFServlet -->
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http-jetty</artifactId>

Modified: cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/client/Client.java?rev=1208005&r1=1208004&r2=1208005&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/client/Client.java
(original)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/client/Client.java
Tue Nov 29 18:21:59 2011
@@ -20,8 +20,7 @@ package demo.spring.client;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-
-import demo.spring.HelloWorld;
+import demo.spring.service.HelloWorld;
 
 
 public final class Client {
@@ -32,7 +31,7 @@ public final class Client {
     public static void main(String args[]) throws Exception {
         // START SNIPPET: client
         ClassPathXmlApplicationContext context 
-            = new ClassPathXmlApplicationContext(new String[] {"demo/spring/client/client-beans.xml"});
+            = new ClassPathXmlApplicationContext(new String[] {"client-beans.xml"});
 
         HelloWorld client = (HelloWorld)context.getBean("client");
 

Added: cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorld.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorld.java?rev=1208005&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorld.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorld.java
Tue Nov 29 18:21:59 2011
@@ -0,0 +1,28 @@
+/**
+ * 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.
+ */
+// START SNIPPET: service
+package demo.spring.service;
+
+import javax.jws.WebService;
+
+@WebService
+public interface HelloWorld {
+    String sayHi(String text);
+}
+// END SNIPPET: service

Added: cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorldImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorldImpl.java?rev=1208005&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorldImpl.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/HelloWorldImpl.java
Tue Nov 29 18:21:59 2011
@@ -0,0 +1,32 @@
+/**
+ * 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.
+ */
+// START SNIPPET: service
+package demo.spring.service;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface = "demo.spring.service.HelloWorld")
+public class HelloWorldImpl implements HelloWorld {
+
+    public String sayHi(String text) {
+        System.out.println("sayHi called");
+        return "Hello " + text;
+    }
+}
+// END SNIPPET: service

Added: cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/Server.java?rev=1208005&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/Server.java
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/java/demo/spring/service/Server.java
Tue Nov 29 18:21:59 2011
@@ -0,0 +1,64 @@
+/**
+ * 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 demo.spring.service;
+
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.webapp.WebAppContext;
+
+public class Server {
+
+    protected Server() throws Exception {
+        System.out.println("Starting Server");
+
+        /**
+         * Important: This code simply starts up a servlet container and adds
+         * the web application in src/webapp to it. Normally you would be using
+         * Jetty or Tomcat and have the webapp packaged as a WAR. This is simply
+         * as a convenience so you do not need to configure your servlet
+         * container to see CXF in action!
+         */
+        org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server();
+
+        SelectChannelConnector connector = new SelectChannelConnector();
+        connector.setPort(9002);
+        server.setConnectors(new Connector[] {connector});
+
+        WebAppContext webappcontext = new WebAppContext();
+        webappcontext.setContextPath("/");
+
+        webappcontext.setWar("target/JavaFirstSpringSupport.war");
+
+        HandlerCollection handlers = new HandlerCollection();
+        handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
+
+        server.setHandler(handlers);
+        server.start();
+        System.out.println("Server ready...");
+        server.join();
+    }
+
+    public static void main(String args[]) throws Exception {
+        new Server();
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/resources/client-beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/resources/client-beans.xml?rev=1208005&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/resources/client-beans.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/resources/client-beans.xml
Tue Nov 29 18:21:59 2011
@@ -0,0 +1,37 @@
+<?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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">
+
+    <bean id="client" class="demo.spring.service.HelloWorld" 
+      factory-bean="clientFactory" factory-method="create"/>
+    
+	<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
+	  <property name="serviceClass" value="demo.spring.service.HelloWorld"/>
+	  <property name="address" value="http://localhost:9002/services/HelloWorld"/>
+	</bean>
+	  
+</beans>
+<!-- END SNIPPET: beans -->

Added: cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml?rev=1208005&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
(added)
+++ cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
Tue Nov 29 18:21:59 2011
@@ -0,0 +1,37 @@
+<?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.
+-->
+<!-- START SNIPPET: beans -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+	<import resource="classpath:META-INF/cxf/cxf.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
+
+	<jaxws:endpoint 
+	  id="helloWorld" 
+	  implementor="demo.spring.service.HelloWorldImpl" 
+	  address="/HelloWorld" />
+	  
+</beans>
+<!-- END SNIPPET: beans -->

Propchange: cxf/trunk/distribution/src/main/release/samples/java_first_spring_support/src/main/webapp/WEB-INF/cxf-servlet.xml
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message