Top Description Inners Fields Constructors Methods
io.undertow.protocols.http2

public Class HpackEncoder

extends Object
Class Inheritance
Imports
io.undertow.util.HeaderMap, .HeaderValues, .Headers, .HttpString, java.nio.ByteBuffer, java.util.ArrayDeque, .ArrayList, .Collections, .Deque, .HashMap, .HashSet, .List, .Map, .Set

Encoder for HPACK frames.
Author
Stuart Douglas

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
public static interface
public static enum
pack-priv static class

Field Summary

Modifier and TypeField and Description
private HeaderMap
private int
currentTableSize

The current table size

public static final HpackEncoder.HpackHeaderFunction
private final Map<HttpString, List<HpackEncoder.TableEntry>>
private static final Map<HttpString, HpackEncoder.TableEntry[]>
private int
private final Deque<HpackEncoder.TableEntry>
private boolean
private long
private final HpackEncoder.HpackHeaderFunction
private int
maxTableSize

The maximum table size

private int
private int
private byte[]
private int
private int
private static final Set<HttpString>

Constructor Summary

AccessConstructor and Description
public
HpackEncoder(int maxTableSize, HpackEncoder.HpackHeaderFunction headerFunction)

public
HpackEncoder(int maxTableSize)

Method Summary

Modifier and TypeMethod and Description
private void
public HpackEncoder.State
encode(HeaderMap headers, ByteBuffer target)

Encodes the headers into a buffer.

private HpackEncoder.TableEntry
findInTable(HttpString headerName, String value)

private void
private void
private void
public void
setMaxTableSize(int newSize)

private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentHeadersback to summary
private HeaderMap currentHeaders
currentTableSizeback to summary
private int currentTableSize

The current table size

DEFAULT_HEADER_FUNCTIONback to summary
public static final HpackEncoder.HpackHeaderFunction DEFAULT_HEADER_FUNCTION
dynamicTableback to summary
private final Map<HttpString, List<HpackEncoder.TableEntry>> dynamicTable
ENCODING_STATIC_TABLEback to summary
private static final Map<HttpString, HpackEncoder.TableEntry[]> ENCODING_STATIC_TABLE
entryPositionCounterback to summary
private int entryPositionCounter
evictionQueueback to summary
private final Deque<HpackEncoder.TableEntry> evictionQueue
firstPassback to summary
private boolean firstPass
headersIteratorback to summary
private long headersIterator
hpackHeaderFunctionback to summary
private final HpackEncoder.HpackHeaderFunction hpackHeaderFunction
maxTableSizeback to summary
private int maxTableSize

The maximum table size

minNewMaxHeaderSizeback to summary
private int minNewMaxHeaderSize
newMaxHeaderSizeback to summary
private int newMaxHeaderSize
overflowDataback to summary
private byte[] overflowData
overflowLengthback to summary
private int overflowLength
overflowPosback to summary
private int overflowPos
SKIPback to summary
private static final Set<HttpString> SKIP

Constructor Detail

HpackEncoderback to summary
public HpackEncoder(int maxTableSize, HpackEncoder.HpackHeaderFunction headerFunction)
HpackEncoderback to summary
public HpackEncoder(int maxTableSize)

Method Detail

addToDynamicTableback to summary
private void addToDynamicTable(HttpString headerName, String val)
encodeback to summary
public HpackEncoder.State encode(HeaderMap headers, ByteBuffer target)

Encodes the headers into a buffer.

findInTableback to summary
private HpackEncoder.TableEntry findInTable(HttpString headerName, String value)
handleTableSizeChangeback to summary
private void handleTableSizeChange(ByteBuffer target)
preventPositionRolloverback to summary
private void preventPositionRollover()
runEvictionIfRequiredback to summary
private void runEvictionIfRequired()
setMaxTableSizeback to summary
public void setMaxTableSize(int newSize)
writeHuffmanEncodableNameback to summary
private void writeHuffmanEncodableName(ByteBuffer target, HttpString headerName)
writeHuffmanEncodableValueback to summary
private void writeHuffmanEncodableValue(ByteBuffer target, HttpString headerName, String val)
writeValueStringback to summary
private void writeValueString(ByteBuffer target, String val)
io.undertow.protocols.http2 back to summary

pack-priv Class HpackEncoder.DynamicTableEntry

extends TableEntry
Class Inheritance

Field Summary

Inherited from io.undertow.protocols.http2.HpackEncoder.TableEntry:
namepositionsizevalue

Constructor Summary

AccessConstructor and Description
pack-priv
DynamicTableEntry(HttpString name, String value, int position)

Method Summary

Modifier and TypeMethod and Description
public int

Constructor Detail

DynamicTableEntryback to summary
pack-priv DynamicTableEntry(HttpString name, String value, int position)

Method Detail

getPositionback to summary
public int getPosition()

Overrides io.undertow.protocols.http2.HpackEncoder.TableEntry.getPosition.

Annotations
@Override
io.undertow.protocols.http2 back to summary

public Interface HpackEncoder.HpackHeaderFunction


Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the value should be encoded
shouldUseHuffman
(HttpString
The header name
header
,
String
The header value to be encoded
value
)

Returns true if huffman encoding should be used on the header value

public boolean

Returns:

true if the value should be encoded
shouldUseHuffman
(HttpString
The header name to be encoded
header
)

Returns true if huffman encoding should be used on the header name

public boolean

Method Detail

shouldUseHuffmanback to summary
public boolean shouldUseHuffman(HttpString header, String value)

Returns true if huffman encoding should be used on the header value

Parameters
header:HttpString

The header name

value:String

The header value to be encoded

Returns:boolean

true if the value should be encoded

shouldUseHuffmanback to summary
public boolean shouldUseHuffman(HttpString header)

Returns true if huffman encoding should be used on the header name

Parameters
header:HttpString

The header name to be encoded

Returns:boolean

true if the value should be encoded

shouldUseIndexingback to summary
public boolean shouldUseIndexing(HttpString header, String value)
io.undertow.protocols.http2 back to summary

public final Enum HpackEncoder.State

extends Enum<HpackEncoder.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final HpackEncoder.State
public static final HpackEncoder.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static HpackEncoder.State
public static HpackEncoder.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COMPLETEback to summary
public static final HpackEncoder.State COMPLETE
OVERFLOWback to summary
public static final HpackEncoder.State OVERFLOW

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static HpackEncoder.State valueOf(String name)
valuesback to summary
public static HpackEncoder.State[] values()
io.undertow.protocols.http2 back to summary

pack-priv Class HpackEncoder.TableEntry

extends Object
Class Inheritance
Known Direct Subclasses
io.undertow.protocols.http2.HpackEncoder.DynamicTableEntry

Field Summary

Modifier and TypeField and Description
pack-priv final HttpString
pack-priv int
pack-priv final int
pack-priv final String

Constructor Summary

AccessConstructor and Description
pack-priv
TableEntry(HttpString name, String value, int position)

Method Summary

Modifier and TypeMethod and Description
public int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
pack-priv final HttpString name
positionback to summary
pack-priv int position
sizeback to summary
pack-priv final int size
valueback to summary
pack-priv final String value

Constructor Detail

TableEntryback to summary
pack-priv TableEntry(HttpString name, String value, int position)

Method Detail

getPositionback to summary
public int getPosition()