Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2013-09-05 23:19:45 +0000
committerGreg Wilkins2013-09-05 23:19:45 +0000
commitc3bd5752ee40dfd4c083f2bbff4e5b97fddb31e2 (patch)
tree2fdcd59b8510ae0599f1216f75380525b5491726
parent810fbdc439c9cf7b96494746fcc9ec73b032859d (diff)
parentee52769dea4ee3fab725f206a5061a9f31e55b50 (diff)
downloadorg.eclipse.jetty.project-c3bd5752ee40dfd4c083f2bbff4e5b97fddb31e2.tar.gz
org.eclipse.jetty.project-c3bd5752ee40dfd4c083f2bbff4e5b97fddb31e2.tar.xz
org.eclipse.jetty.project-c3bd5752ee40dfd4c083f2bbff4e5b97fddb31e2.zip
Merge remote-tracking branch 'origin/master' into jetty-9.1
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/Response.java6
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java7
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/DefaultServlet.java1
3 files changed, 7 insertions, 7 deletions
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java
index feb3286745..b32e681ec7 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java
@@ -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)
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java
index b248e3f76e..451e3afae1 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java
@@ -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());
}
-
}
}
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 4a32465a73..97f69b295a 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
@@ -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();

Back to the top