You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by cs...@apache.org on 2012/12/02 18:00:39 UTC
svn commit: r1416201 - in /cxf/dosgi/trunk/dsw/cxf-dsw/src:
main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
Author: cschneider
Date: Sun Dec 2 17:00:38 2012
New Revision: 1416201
URL: http://svn.apache.org/viewvc?rev=1416201&view=rev
Log:
DOSGI-127 Bug fix in default cxf servlet alias and added tests
Modified:
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java?rev=1416201&r1=1416200&r2=1416201&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java Sun Dec 2 17:00:38 2012
@@ -58,7 +58,7 @@ public class HttpServiceManager {
this.bundleContext = bundleContext;
this.tracker = tracker;
this.httpBase = getWithDefault(httpBase, "http://" + LocalHostUtil.getLocalIp() + ":8181");
- this.cxfServletAlias = getWithDefault(cxfServletAlias, "cxf");
+ this.cxfServletAlias = getWithDefault(cxfServletAlias, "/cxf");
}
private String getWithDefault(String value, String defaultValue) {
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java?rev=1416201&r1=1416200&r2=1416201&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManagerTest.java Sun Dec 2 17:00:38 2012
@@ -46,6 +46,22 @@ import org.osgi.service.http.NamespaceEx
public class HttpServiceManagerTest extends TestCase {
+ public void testGetAbsoluteAddress() {
+ IMocksControl c = EasyMock.createControl();
+ BundleContext bundleContext = c.createMock(BundleContext.class);
+ c.replay();
+ HttpServiceManager manager = new HttpServiceManager(bundleContext, null, null, null);
+ String localIp = LocalHostUtil.getLocalIp();
+
+ String address1 = manager.getAbsoluteAddress(bundleContext, null, "/myservice");
+ assertEquals("http://" + localIp + ":8181/cxf/myservice", address1);
+
+ String address2 = manager.getAbsoluteAddress(bundleContext, "/mycontext", "/myservice");
+ assertEquals("http://" + localIp + ":8181/mycontext/myservice", address2);
+
+ c.verify();
+ }
+
public void testRegisterAndUnregisterServlet() throws Exception {
IMocksControl c = EasyMock.createControl();
BundleContext dswContext = c.createMock(BundleContext.class);