Browse Source

ResourceHttpRequestHandler explicitly closes a Resource's InputStream

Issue: SPR-11644
(cherry picked from commit 3a96f16)
pull/531/head
Juergen Hoeller 12 years ago
parent
commit
d1030b798d
  1. 12
      spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java

12
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java

@ -251,7 +251,17 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
* @throws IOException in case of errors while writing the content * @throws IOException in case of errors while writing the content
*/ */
protected void writeContent(HttpServletResponse response, Resource resource) throws IOException { protected void writeContent(HttpServletResponse response, Resource resource) throws IOException {
StreamUtils.copy(resource.getInputStream(), response.getOutputStream()); InputStream in = resource.getInputStream();
try {
StreamUtils.copy(in, response.getOutputStream());
}
finally {
try {
in.close();
}
catch (IOException ex) {
}
}
} }

Loading…
Cancel
Save