Jetty9 - Added and used shortcut method getByteBufferPool() in place of getConnector().getByteBufferPool(), also used by tests.

This commit is contained in:
Simone Bordet 2012-08-23 18:36:28 +02:00
parent c009cef661
commit 90029a14eb
2 changed files with 8 additions and 2 deletions

View File

@ -39,6 +39,7 @@ import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.EofException; import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.server.handler.ErrorHandler; import org.eclipse.jetty.server.handler.ErrorHandler;
@ -126,6 +127,11 @@ public class HttpChannel implements HttpParser.RequestHandler, Runnable
return _connector; return _connector;
} }
public ByteBufferPool getByteBufferPool()
{
return _connector.getByteBufferPool();
}
public HttpConfiguration getHttpConfiguration() public HttpConfiguration getHttpConfiguration()
{ {
return _configuration; return _configuration;

View File

@ -139,7 +139,7 @@ public class HttpOutput extends ServletOutputStream
} }
// Allocate an aggregate buffer // Allocate an aggregate buffer
_aggregate = _channel.getConnector().getByteBufferPool().acquire(size, false); _aggregate = _channel.getByteBufferPool().acquire(size, false);
} }
// Do we have space to aggregate ? // Do we have space to aggregate ?
@ -179,7 +179,7 @@ public class HttpOutput extends ServletOutputStream
throw new EOFException(); throw new EOFException();
if (_aggregate == null) if (_aggregate == null)
_aggregate = _channel.getConnector().getByteBufferPool().acquire(getBufferSize(), false); _aggregate = _channel.getByteBufferPool().acquire(getBufferSize(), false);
BufferUtil.append(_aggregate, (byte)b); BufferUtil.append(_aggregate, (byte)b);
_written++; _written++;