You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/09/18 20:28:05 UTC
svn commit: r1626040 - in /tomee/tomee/trunk:
arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/
tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/
tomee/tomee-catalina/src...
Author: rmannibucau
Date: Thu Sep 18 18:28:05 2014
New Revision: 1626040
URL: http://svn.apache.org/r1626040
Log:
TOMEE-1351 handling of ROOT for jaxws
Added:
tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/RootContextTest.java
- copied, changed from r1625888, tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java
Modified:
tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java
tomee/tomee/trunk/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java
Copied: tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/RootContextTest.java (from r1625888, tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java)
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/RootContextTest.java?p2=tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/RootContextTest.java&p1=tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java&r1=1625888&r2=1626040&rev=1626040&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/JAXWSTest.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/RootContextTest.java Thu Sep 18 18:28:05 2014
@@ -32,20 +32,19 @@ import java.net.URL;
import static org.junit.Assert.assertEquals;
@RunWith(Arquillian.class)
-public class JAXWSTest {
-
+public class RootContextTest {
@ArquillianResource
private URL url;
@Deployment(testable = false)
public static WebArchive createDeployment() {
- return ShrinkWrap.create(WebArchive.class, JAXWSTest.class.getName().concat(".war"))
+ return ShrinkWrap.create(WebArchive.class, "ROOT.war")
.addClasses(Hello.class, Hello2.class, HelloWS.class, HelloWS2.class);
}
@Test
public void invoke() throws Exception {
- final Service service = Service.create(new URL(url.toExternalForm() + "webservices/HelloWS?wsdl"), new QName("http://jaxws.tests.arquillian.openejb.apache.org/", "HelloWSService"));
+ final Service service = Service.create(new URL(url.toExternalForm() + "/webservices/HelloWS?wsdl"), new QName("http://jaxws.tests.arquillian.openejb.apache.org/", "HelloWSService"));
final Hello hello = service.getPort(Hello.class);
assertEquals("hi foo!", hello.hi("foo"));
}
Modified: tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java?rev=1626040&r1=1626039&r2=1626040&view=diff
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java (original)
+++ tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java Thu Sep 18 18:28:05 2014
@@ -495,6 +495,8 @@ public class TomcatWebAppBuilder impleme
if (standardContext.getPath() == null) {
if (webApp.contextRoot != null && webApp.contextRoot.startsWith("/")) {
standardContext.setPath(webApp.contextRoot);
+ } else if (isRoot(webApp.contextRoot)) {
+ standardContext.setPath("");
} else {
standardContext.setPath("/" + webApp.contextRoot);
}
@@ -555,7 +557,7 @@ public class TomcatWebAppBuilder impleme
}
private static boolean isRoot(final String name) {
- return "/ROOT".equals(name) || "ROOT".equals(name) || name == null || name.isEmpty();
+ return "/ROOT".equals(name) || "ROOT".equals(name) || name == null || name.isEmpty() || "ROOT.war".equals(name);
}
public void deployWar(final StandardContext standardContext, final String host, final AppInfo info) {
Modified: tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java?rev=1626040&r1=1626039&r2=1626040&view=diff
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java (original)
+++ tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/deployment/TomcatWebappDeployer.java Thu Sep 18 18:28:05 2014
@@ -100,6 +100,9 @@ public class TomcatWebappDeployer implem
if (context == null) {
webAppInfo.contextRoot = file.getName();
+ if ("ROOT".equals(webAppInfo.contextRoot)) {
+ webAppInfo.contextRoot = "";
+ }
} else {
webAppInfo.contextRoot = context;
}
Modified: tomee/tomee/trunk/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java?rev=1626040&r1=1626039&r2=1626040&view=diff
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java (original)
+++ tomee/tomee/trunk/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java Thu Sep 18 18:28:05 2014
@@ -411,6 +411,9 @@ public class Container implements AutoCl
if (sameApplication(file, webApp)) {
webApp.moduleId = name;
webApp.contextRoot = lastPart(name, webApp.contextRoot);
+ if ("ROOT".equals(webApp.contextRoot)) {
+ webApp.contextRoot = "";
+ }
}
}
}
Modified: tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java?rev=1626040&r1=1626039&r2=1626040&view=diff
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java (original)
+++ tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java Thu Sep 18 18:28:05 2014
@@ -102,7 +102,10 @@ public class TomcatWsRegistry implements
throw new IllegalArgumentException("Invalid virtual host '" + virtualHost + "'. Do you have a matchiing Host entry in the server.xml?");
}
- if (!contextRoot.startsWith("/")) {
+ if ("ROOT".equals(contextRoot)) { // doesn't happen in tomee itself but with all our tooling around
+ contextRoot = "";
+ }
+ if (!contextRoot.startsWith("/") && !contextRoot.isEmpty()) {
contextRoot = "/" + contextRoot;
}
@@ -207,15 +210,14 @@ public class TomcatWsRegistry implements
// - new way (/<webappcontext>/webservices/<name>) if webcontext is specified
if (context != null) {
String root = context;
- if (!root.startsWith("/")) {
- root = '/' + root;
+ if ("ROOT".equals(root)) {
+ root = "";
}
-
- Context webAppContext = Context.class.cast(host.findChild(root));
- if (webAppContext == null && "/".equals(root)) {
- webAppContext = Context.class.cast(host.findChild(root.substring(1)));
+ if (!root.startsWith("/") && !root.isEmpty()) {
+ root = '/' + root;
}
+ final Context webAppContext = Context.class.cast(host.findChild(root));
if (webAppContext != null) {
// sub context = '/' means the service address is provided by webservices
if (WEBSERVICE_SUB_CONTEXT.equals("/") && path.startsWith("/")) {
@@ -348,10 +350,12 @@ public class TomcatWsRegistry implements
final StringBuilder fullContextpath;
if (!WEBSERVICE_OLDCONTEXT_ACTIVE && !fakeDeployment) {
String contextPath = context.getName();
- if (contextPath != null && !contextPath.startsWith("/")) {
- contextPath = "/" + contextPath;
- } else if (contextPath == null) {
- contextPath = "/";
+ if (contextPath == null || !contextPath.isEmpty()) {
+ if (contextPath != null && !contextPath.startsWith("/")) {
+ contextPath = "/" + contextPath;
+ } else if (contextPath == null) {
+ contextPath = "/";
+ }
}
fullContextpath = new StringBuilder(contextPath);