Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
This commit is contained in:
commit
3b33ed2af2
|
@ -475,9 +475,9 @@ public class HttpOutput extends ServletOutputStream implements Runnable
|
|||
synchronized (_channelState)
|
||||
{
|
||||
_state = State.CLOSED;
|
||||
}
|
||||
releaseBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
|
@ -601,10 +601,13 @@ public class HttpOutput extends ServletOutputStream implements Runnable
|
|||
|
||||
public ByteBuffer getBuffer()
|
||||
{
|
||||
return _aggregate;
|
||||
synchronized (_channelState)
|
||||
{
|
||||
return acquireBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer acquireBuffer()
|
||||
private ByteBuffer acquireBuffer()
|
||||
{
|
||||
if (_aggregate == null)
|
||||
_aggregate = _channel.getByteBufferPool().acquire(getBufferSize(), _channel.isUseOutputDirectByteBuffers());
|
||||
|
@ -1361,12 +1364,15 @@ public class HttpOutput extends ServletOutputStream implements Runnable
|
|||
}
|
||||
|
||||
public void resetBuffer()
|
||||
{
|
||||
synchronized (_channelState)
|
||||
{
|
||||
_interceptor.resetBuffer();
|
||||
if (BufferUtil.hasContent(_aggregate))
|
||||
BufferUtil.clear(_aggregate);
|
||||
_written = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWriteListener(WriteListener writeListener)
|
||||
|
|
|
@ -298,7 +298,7 @@ public class ErrorHandler extends AbstractHandler
|
|||
// TODO error page may cause a BufferOverflow. In which case we try
|
||||
// TODO again with stacks disabled. If it still overflows, it is
|
||||
// TODO written without a body.
|
||||
ByteBuffer buffer = baseRequest.getResponse().getHttpOutput().acquireBuffer();
|
||||
ByteBuffer buffer = baseRequest.getResponse().getHttpOutput().getBuffer();
|
||||
ByteBufferOutputStream out = new ByteBufferOutputStream(buffer);
|
||||
PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, charset));
|
||||
|
||||
|
|
Loading…
Reference in New Issue