327725 cleanup

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2368 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-10-19 23:10:36 +00:00
parent 5ab4634dfb
commit 75648cc095
4 changed files with 10 additions and 7 deletions

View File

@ -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;
}
/* ------------------------------------------------------------ */

View File

@ -223,7 +223,7 @@ public class ResourceCache
return content;
}
return new HttpContent.ResourceAsHttpContent(resource,_mimeTypes);
return new HttpContent.ResourceAsHttpContent(resource,_mimeTypes.getMimeByExtension(resource.toString()));
}

View File

@ -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);
}

View File

@ -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");