ShallowEtagHeaderFilter supports Servlet 3.1's setContentLengthLong as well
Issue: SPR-12097
This commit is contained in:
@@ -46,6 +46,7 @@ import org.springframework.web.util.WebUtils;
|
|||||||
*
|
*
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
|
* @author Juergen Hoeller
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
|
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
|
@Override
|
||||||
public void setBufferSize(int size) {
|
public void setBufferSize(int size) {
|
||||||
if (size > this.content.capacity()) {
|
if (size > this.content.capacity()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user