ShallowEtagHeaderFilter supports Servlet 3.1's setContentLengthLong as well
Issue: SPR-12097
This commit is contained in:
parent
110be33337
commit
0c32d66cbd
|
@ -46,6 +46,7 @@ import org.springframework.web.util.WebUtils;
|
|||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.0
|
||||
*/
|
||||
public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
|
||||
|
@ -246,6 +247,17 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
|
|||
}
|
||||
}
|
||||
|
||||
// Overrides Servlet 3.1 setContentLengthLong(long) at runtime
|
||||
public void setContentLengthLong(long len) {
|
||||
if (len > Integer.MAX_VALUE) {
|
||||
throw new IllegalArgumentException("Content-Length exceeds ShallowEtagHeaderFilter's maximum (" +
|
||||
Integer.MAX_VALUE + "): " + len);
|
||||
}
|
||||
if (len > this.content.capacity()) {
|
||||
this.content.resize((int) len);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBufferSize(int size) {
|
||||
if (size > this.content.capacity()) {
|
||||
|
|
Loading…
Reference in New Issue