servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r731906 - in /servicemix/smx3/branches/servicemix-3.2: deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/ distributions/apache-servicemix-web/ distributions/apache-servicemix-web/src/main/java/org/apa...
Date Tue, 06 Jan 2009 10:24:14 GMT
Author: ffang
Date: Tue Jan  6 02:24:12 2009
New Revision: 731906

URL: http://svn.apache.org/viewvc?rev=731906&view=rev
Log:
[SM-1756]add CXFManagedServlet to apache-servicemix-web to enable servicemix-cxf-bc endpoint
deploy into servlet container without starting jetty

Added:
    servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/cxf/
    servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/cxf/CXFManagedServlet.java
  (with props)
Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
    servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/pom.xml
    servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/web.xml

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=731906&r1=731905&r2=731906&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Tue Jan  6 02:24:12 2009
@@ -47,6 +47,7 @@
 import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.attachment.AttachmentImpl;
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.jbi.JBIFault;
@@ -555,6 +556,11 @@
             if (bus == null) {
                 SpringBusFactory bf = new SpringBusFactory();
                 bus = bf.createBus(getBusCfg());
+                if (locationURI != null && locationURI.startsWith("/")) {
+                    //it's in the servlet container
+                    //set this bus so that it could be used in CXFManagerServlet
+                    BusFactory.setDefaultBus(bus);
+                }
             }
             return bus;
         } else {

Modified: servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/pom.xml?rev=731906&r1=731905&r2=731906&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/pom.xml (original)
+++ servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/pom.xml Tue
Jan  6 02:24:12 2009
@@ -128,6 +128,26 @@
       <artifactId>mail</artifactId>
       <version>1.4</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-transports-http</artifactId>
+      <version>${cxf-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-frontend-jaxws</artifactId>
+      <version>${cxf-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-transports-jbi</artifactId>
+      <version>${cxf-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-bindings-jbi</artifactId>
+      <version>${cxf-version}</version>
+    </dependency>
   </dependencies>
 
   <build>

Added: servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/cxf/CXFManagedServlet.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/cxf/CXFManagedServlet.java?rev=731906&view=auto
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/cxf/CXFManagedServlet.java
(added)
+++ servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/cxf/CXFManagedServlet.java
Tue Jan  6 02:24:12 2009
@@ -0,0 +1,53 @@
+/*
+ * 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.servicemix.web.cxf;
+
+
+import java.util.logging.Logger;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.apache.cxf.transport.servlet.ServletContextResourceResolver;
+
+
+
+public class CXFManagedServlet extends CXFNonSpringServlet {
+    
+    static final Logger LOG = getLogger();
+    @Override
+    public void loadBus(ServletConfig servletConfig) throws ServletException {
+        loadBusNoConfig(servletConfig);
+        // You could add the endpoint publish codes here
+    }
+
+    private void loadBusNoConfig(ServletConfig servletConfig) throws ServletException {
+
+        bus = BusFactory.getDefaultBus();
+        ResourceManager resourceManager = bus.getExtension(ResourceManager.class);
+        resourceManager.addResourceResolver(new ServletContextResourceResolver(
+                                               servletConfig.getServletContext()));
+
+        replaceDestinationFactory();
+        // Set up the ServletController
+        controller = createServletController(servletConfig);
+
+    }
+}

Propchange: servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/cxf/CXFManagedServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/cxf/CXFManagedServlet.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/web.xml?rev=731906&r1=731905&r2=731906&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/web.xml
(original)
+++ servicemix/smx3/branches/servicemix-3.2/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/web.xml
Tue Jan  6 02:24:12 2009
@@ -104,6 +104,18 @@
         <url-pattern>/jbi/*</url-pattern>
     </servlet-mapping>
 
+    <servlet>
+      <servlet-name>cxf</servlet-name>
+      <display-name>cxf</display-name>
+      <description>Apache CXF Endpoint</description>
+      <servlet-class>org.apache.servicemix.web.cxf.CXFManagedServlet</servlet-class>
+      <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+      <servlet-name>cxf</servlet-name>
+      <url-pattern>/services/*</url-pattern>
+  </servlet-mapping> 
+
 	  <welcome-file-list>
 			<welcome-file>index.html</welcome-file>
 			<welcome-file>index.jsp</welcome-file>



Mime
View raw message