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 2016/02/17 13:54:13 UTC
tomee git commit: better handling of resources in HttpRequestImpl
Repository: tomee
Updated Branches:
refs/heads/master 3186829e3 -> f54d40789
better handling of resources in HttpRequestImpl
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f54d4078
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f54d4078
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f54d4078
Branch: refs/heads/master
Commit: f54d40789862c8b19ef61c6b595d91ec06e8874b
Parents: 3186829
Author: Romain manni-Bucau <rm...@gmail.com>
Authored: Wed Feb 17 13:53:55 2016 +0100
Committer: Romain manni-Bucau <rm...@gmail.com>
Committed: Wed Feb 17 13:53:55 2016 +0100
----------------------------------------------------------------------
.../org/apache/openejb/server/httpd/HttpListenerRegistry.java | 4 ++--
.../java/org/apache/openejb/server/httpd/HttpRequestImpl.java | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/f54d4078/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java
----------------------------------------------------------------------
diff --git a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java
index ae80d63..e5e6832 100644
--- a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java
+++ b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpListenerRegistry.java
@@ -128,7 +128,7 @@ public class HttpListenerRegistry implements HttpListener {
defaultContextTypes.put("txt", "text/plain");
defaultContextTypes.put("xml", "application/xml");
defaultContextTypes.put("xsl", "application/xml");
- defaultContextTypes.put("js", "text/javascript");
+ defaultContextTypes.put("js", "application/javascript");
defaultContextTypes.put("gif", "image/gif");
defaultContextTypes.put("jpeg", "image/jpeg");
defaultContextTypes.put("jpg", "image/jpeg");
@@ -197,7 +197,7 @@ public class HttpListenerRegistry implements HttpListener {
if (url != null) {
serveResource(servletPath, response, url);
} else {
- final String pathWithoutSlash = "/".equals(path) ? welcomeFile :
+ final String pathWithoutSlash = "/".equals(path) || "".equals(servletPath) || "/".equals(servletPath) ? welcomeFile :
(servletPath.startsWith("/") ? servletPath.substring(1) : servletPath);
url = defaultClassLoader.getResource("META-INF/resources/" + pathWithoutSlash);
if (url != null) {
http://git-wip-us.apache.org/repos/asf/tomee/blob/f54d4078/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
----------------------------------------------------------------------
diff --git a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
index 28274d3..fa2428c 100644
--- a/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
+++ b/server/openejb-http/src/main/java/org/apache/openejb/server/httpd/HttpRequestImpl.java
@@ -293,7 +293,7 @@ public class HttpRequestImpl implements HttpRequest {
if (servletPath != null) {
return servletPath;
}
- if ("/".equals(path) && uri != null) { // not initialized, contextpath = "" so let use it for our router (HttpListenerRegistry)
+ if ("/".equals(path) && uri != null && "".equals(contextPath)) { // not initialized, contextpath = "" so let use it for our router (HttpListenerRegistry)
return uri.getPath();
}
return path;