Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-08-14 02:03:08 -0400
committerGreg Wilkins2015-08-14 02:03:08 -0400
commit087b4c94d74c6c5f175b8fdce7a938952e43cab7 (patch)
tree2a32911b7acf4b4457d5ab6a8d8c21e37a231d2d /jetty-servlet
parent6274522787bb0c4b737913e33df71f9b5e66b1f2 (diff)
downloadorg.eclipse.jetty.project-087b4c94d74c6c5f175b8fdce7a938952e43cab7.tar.gz
org.eclipse.jetty.project-087b4c94d74c6c5f175b8fdce7a938952e43cab7.tar.xz
org.eclipse.jetty.project-087b4c94d74c6c5f175b8fdce7a938952e43cab7.zip
474358 - DefaultServlet bad Content-Type on compressed content
Diffstat (limited to 'jetty-servlet')
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java4
-rw-r--r--jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java
index 97c6173945..1942359252 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java
@@ -519,7 +519,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
{
// ensure we have content
if (content==null)
- content=new ResourceHttpContent(resource,_mimeTypes.getMimeByExtension(resource.toString()),response.getBufferSize(),_etags);
+ content=new ResourceHttpContent(resource,_mimeTypes.getMimeByExtension(pathInContext),response.getBufferSize(),_etags);
if (included.booleanValue() || passConditionalHeaders(request,response, resource,content))
{
@@ -591,7 +591,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
}
else
{
- content=new ResourceHttpContent(resource,_mimeTypes.getMimeByExtension(resource.toString()),_etags);
+ content=new ResourceHttpContent(resource,_mimeTypes.getMimeByExtension(pathInContext),_etags);
if (included.booleanValue() || passConditionalHeaders(request,response, resource,content))
sendDirectory(request,response,resource,pathInContext);
}
diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java
index b179319ad9..7c58a0aadb 100644
--- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java
+++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java
@@ -705,6 +705,7 @@ public class DefaultServletTest
String response = connector.getResponses("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\n\r\n");
assertResponseContains("Content-Length: 12", response);
+ assertResponseContains("Content-Type: text/plain",response);
assertResponseContains("Hello Text 0",response);
assertResponseContains("Vary: Accept-Encoding",response);
assertResponseNotContains("Content-Encoding: gzip",response);
@@ -712,6 +713,7 @@ public class DefaultServletTest
response = connector.getResponses("GET /context/data0.txt HTTP/1.0\r\nHost:localhost:8080\r\nAccept-Encoding:gzip\r\n\r\n");
assertResponseContains("Content-Length: 9", response);
assertResponseContains("fake gzip",response);
+ assertResponseContains("Content-Type: text/plain",response);
assertResponseContains("Vary: Accept-Encoding",response);
assertResponseContains("Content-Encoding: gzip",response);

Back to the top