changed contentLength() from int to long

This commit is contained in:
Juergen Hoeller
2010-08-09 15:58:07 +00:00
parent e250ff0fb4
commit 771db05608
4 changed files with 9 additions and 5 deletions

View File

@@ -148,7 +148,11 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
if (mediaType != null) {
response.setContentType(mediaType.toString());
}
response.setContentLength(resource.contentLength());
long length = resource.contentLength();
if (length > Integer.MAX_VALUE) {
throw new IOException("Resource content too long (beyond Integer.MAX_VALUE): " + resource);
}
response.setContentLength((int) length);
FileCopyUtils.copy(resource.getInputStream(), response.getOutputStream());
}