458527 - Implement an async proxy servlet that can perform content transformations.

Handle jetty-9.3 isReady at EOF behaviour
This commit is contained in:
Greg Wilkins 2015-02-04 16:27:29 +11:00
parent 5e95caaf29
commit 2563ef6871
1 changed files with 5 additions and 1 deletions

View File

@ -226,14 +226,18 @@ public class AsyncMiddleManServlet extends AbstractProxyServlet
while (input.isReady() && !input.isFinished())
{
int read = readClientRequestContent(input, buffer);
if (_log.isDebugEnabled())
_log.debug("{} asynchronous read {} bytes on {}", getRequestId(clientRequest), read, input);
if (read<0)
return Action.SUCCEEDED;
if (contentLength > 0 && read > 0)
length += read;
ByteBuffer content = read > 0 ? ByteBuffer.wrap(buffer, 0, read) : BufferUtil.EMPTY_BUFFER;
boolean finished = read < 0 || length == contentLength;
boolean finished = length == contentLength;
process(content, this, finished);
if (read > 0)