You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/04/09 17:47:51 UTC
svn commit: r646413 - in
/servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi: ./
src/main/java/org/apache/servicemix/cxf/transport/http_osgi/
src/main/resources/META-INF/spring/
Author: gnodet
Date: Wed Apr 9 08:47:50 2008
New Revision: 646413
URL: http://svn.apache.org/viewvc?rev=646413&view=rev
Log:
Fix osgi transport
Added:
servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/SpringOsgiServlet.java
Modified:
servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/pom.xml
servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/OsgiServlet.java
servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml
Modified: servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/pom.xml?rev=646413&r1=646412&r2=646413&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/pom.xml (original)
+++ servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/pom.xml Wed Apr 9 08:47:50 2008
@@ -46,6 +46,11 @@
<artifactId>cxf-bundle</artifactId>
<version>${cxf.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
</dependencies>
<build>
Modified: servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/OsgiServlet.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/OsgiServlet.java?rev=646413&r1=646412&r2=646413&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/OsgiServlet.java (original)
+++ servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/OsgiServlet.java Wed Apr 9 08:47:50 2008
@@ -104,9 +104,9 @@
}
String base = forcedBaseAddress == null ? getBaseURL(request) : forcedBaseAddress;
- if (base.equals(lastBase)) {
- return;
- }
+ //if (base.equals(lastBase)) {
+ // return;
+ //}
Set<String> paths = transport.getDestinationsPaths();
for (String path : paths) {
OsgiDestination d2 = transport.getDestinationForPath(path);
Added: servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/SpringOsgiServlet.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/SpringOsgiServlet.java?rev=646413&view=auto
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/SpringOsgiServlet.java (added)
+++ servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/java/org/apache/servicemix/cxf/transport/http_osgi/SpringOsgiServlet.java Wed Apr 9 08:47:50 2008
@@ -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.cxf.transport.http_osgi;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.ApplicationContext;
+
+public class SpringOsgiServlet extends OsgiServlet implements ApplicationContextAware {
+
+ private ApplicationContext applicationContext;
+
+ public SpringOsgiServlet(OsgiDestinationRegistry transport) {
+ super(transport);
+ }
+
+ public ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
+ public void invoke(HttpServletRequest request, HttpServletResponse res) throws ServletException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(applicationContext.getClassLoader());
+ super.invoke(request, res);
+ } finally {
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+ }
+}
Modified: servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml?rev=646413&r1=646412&r2=646413&view=diff
==============================================================================
--- servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml (original)
+++ servicemix/smx4/features/trunk/ejb3/cxf-transport-osgi/src/main/resources/META-INF/spring/cxf-transport-osgi.xml Wed Apr 9 08:47:50 2008
@@ -26,7 +26,7 @@
<bean id="destinationRegistry" class="org.apache.servicemix.cxf.transport.http_osgi.OsgiDestinationRegistry" />
- <bean id="osgiServlet" class="org.apache.servicemix.cxf.transport.http_osgi.OsgiServlet">
+ <bean id="osgiServlet" class="org.apache.servicemix.cxf.transport.http_osgi.SpringOsgiServlet">
<constructor-arg ref="destinationRegistry"/>
</bean>