Added headerTableSize parameter.

This commit is contained in:
Simone Bordet 2014-06-11 13:36:52 +02:00
parent c8e2a79237
commit 78cbed1236
2 changed files with 14 additions and 3 deletions

View File

@ -29,12 +29,12 @@ public class Generator
private final ByteBufferPool byteBufferPool; private final ByteBufferPool byteBufferPool;
private final FrameGenerator[] generators; private final FrameGenerator[] generators;
public Generator(ByteBufferPool byteBufferPool) public Generator(ByteBufferPool byteBufferPool, int headerTableSize)
{ {
this.byteBufferPool = byteBufferPool; this.byteBufferPool = byteBufferPool;
HeaderGenerator headerGenerator = new HeaderGenerator(); HeaderGenerator headerGenerator = new HeaderGenerator();
HpackEncoder encoder = new HpackEncoder(); HpackEncoder encoder = new HpackEncoder(headerTableSize);
this.generators = new FrameGenerator[FrameType.values().length]; this.generators = new FrameGenerator[FrameType.values().length];
this.generators[FrameType.DATA.getType()] = new DataGenerator(headerGenerator); this.generators[FrameType.DATA.getType()] = new DataGenerator(headerGenerator);

View File

@ -43,6 +43,7 @@ public class HTTP2ServerConnectionFactory extends AbstractConnectionFactory
private static final String CHANNEL_ATTRIBUTE = HttpChannelOverHTTP2.class.getName(); private static final String CHANNEL_ATTRIBUTE = HttpChannelOverHTTP2.class.getName();
private final HttpConfiguration httpConfiguration; private final HttpConfiguration httpConfiguration;
private int headerTableSize = 4096;
public HTTP2ServerConnectionFactory(HttpConfiguration httpConfiguration) public HTTP2ServerConnectionFactory(HttpConfiguration httpConfiguration)
{ {
@ -50,12 +51,22 @@ public class HTTP2ServerConnectionFactory extends AbstractConnectionFactory
this.httpConfiguration = httpConfiguration; this.httpConfiguration = httpConfiguration;
} }
public int getHeaderTableSize()
{
return headerTableSize;
}
public void setHeaderTableSize(int headerTableSize)
{
this.headerTableSize = headerTableSize;
}
@Override @Override
public Connection newConnection(Connector connector, EndPoint endPoint) public Connection newConnection(Connector connector, EndPoint endPoint)
{ {
Session.Listener listener = new HTTPServerSessionListener(connector, httpConfiguration, endPoint); Session.Listener listener = new HTTPServerSessionListener(connector, httpConfiguration, endPoint);
Generator generator = new Generator(connector.getByteBufferPool()); Generator generator = new Generator(connector.getByteBufferPool(), getHeaderTableSize());
HTTP2ServerSession session = new HTTP2ServerSession(endPoint, generator, listener); HTTP2ServerSession session = new HTTP2ServerSession(endPoint, generator, listener);
Parser parser = new ServerParser(connector.getByteBufferPool(), session); Parser parser = new ServerParser(connector.getByteBufferPool(), session);