diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpContent.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpContent.java index bdb3c76580c..38a73d12ab9 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpContent.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpContent.java @@ -42,18 +42,18 @@ public interface HttpContent public class ResourceAsHttpContent implements HttpContent { final Resource _resource; - final MimeTypes _mimeTypes; + final Buffer _mimeType; - public ResourceAsHttpContent(final Resource resource, final MimeTypes mimeTypes) + public ResourceAsHttpContent(final Resource resource, final Buffer mimeType) { _resource=resource; - _mimeTypes=mimeTypes; + _mimeType=mimeType; } /* ------------------------------------------------------------ */ public Buffer getContentType() { - return _mimeTypes.getMimeByExtension(_resource.toString()); + return _mimeType; } /* ------------------------------------------------------------ */ diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceCache.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceCache.java index c2eec9a77f9..4f107dfd7ae 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceCache.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceCache.java @@ -223,7 +223,7 @@ public class ResourceCache return content; } - return new HttpContent.ResourceAsHttpContent(resource,_mimeTypes); + return new HttpContent.ResourceAsHttpContent(resource,_mimeTypes.getMimeByExtension(resource.toString())); } 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 7b0be494cab..594963ea2c9 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 @@ -462,7 +462,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory { // ensure we have content if (content==null) - content=new HttpContent.ResourceAsHttpContent(resource,_mimeTypes); + content=new HttpContent.ResourceAsHttpContent(resource,_mimeTypes.getMimeByExtension(resource.toString())); if (included.booleanValue() || passConditionalHeaders(request,response, resource,content)) { @@ -532,7 +532,7 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory } else { - content=new HttpContent.ResourceAsHttpContent(resource,_mimeTypes); + content=new HttpContent.ResourceAsHttpContent(resource,_mimeTypes.getMimeByExtension(resource.toString())); 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 8369594b777..1c72f546a19 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 @@ -313,6 +313,9 @@ public class DefaultServletTest defholder.setInitParameter("welcomeServlets","false"); defholder.setInitParameter("gzip","false"); defholder.setInitParameter("resourceBase",resBasePath); + defholder.setInitParameter("maxCacheSize","1024000"); + defholder.setInitParameter("maxCachedFileSize","512000"); + defholder.setInitParameter("maxCachedFiles","100"); ServletHolder jspholder = context.addServlet(NoJspServlet.class,"*.jsp");