Merge remote-tracking branch 'origin/master' into jetty-9.1

This commit is contained in:
Greg Wilkins 2013-09-06 09:19:45 +10:00
commit c3bd5752ee
3 changed files with 7 additions and 7 deletions

View File

@ -137,10 +137,10 @@ public class Response implements HttpServletResponse
Response response = _channel.getResponse();
String contentType = httpContent.getContentType();
if (contentType != null && !response.getHttpFields().containsKey(HttpHeader.CONTENT_TYPE.asString()))
response.getHttpFields().put(HttpHeader.CONTENT_TYPE, contentType);
setContentType(contentType);
if (httpContent.getContentLength() > 0)
response.getHttpFields().putLongField(HttpHeader.CONTENT_LENGTH, httpContent.getContentLength());
setLongContentLength(httpContent.getContentLength());
String lm = httpContent.getLastModified();
if (lm != null)

View File

@ -602,19 +602,20 @@ public class ResourceHandler extends HandlerWrapper
HttpFields fields = ((Response)response).getHttpFields();
if (length>0)
fields.putLongField(HttpHeader.CONTENT_LENGTH,length);
((Response)response).setLongContentLength(length);
if (_cacheControl!=null)
fields.put(HttpHeader.CACHE_CONTROL,_cacheControl);
}
else
{
if (length>0)
if (length>Integer.MAX_VALUE)
response.setHeader(HttpHeader.CONTENT_LENGTH.asString(),Long.toString(length));
else if (length>0)
response.setContentLength((int)length);
if (_cacheControl!=null)
response.setHeader(HttpHeader.CACHE_CONTROL.asString(),_cacheControl.toString());
}
}
}

View File

@ -988,7 +988,6 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
else
// Handle cached resource
(resource).writeTo(multi,start,size);
}
if (in!=null)
in.close();