public final class RqLengthAware extends RqWrap
This decorator may help when you're planning to read the body of the request using its read() and available() methods, but you're not sure that available() is always saying the truth. In most cases, the browser will not close the request and will always return positive number in available() method. Thus, you won't be able to reach the end of the stream ever. The browser wants you to respect the "Content-Length" header and read as many bytes as it requests. To solve that, just wrap your request into this decorator.
The class is immutable and thread-safe.
RqMultipart
,
RqPrint
Constructor and Description |
---|
RqLengthAware(Request req)
Ctor.
|
public RqLengthAware(Request req)
req
- Original requestCopyright © 2015 Take. All rights reserved.