Top Description Inners Fields Constructors Methods
org.eclipse.jetty.http2.parser

public Class Parser

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jetty.http2.parser.ServerParser
Imports
java.nio.ByteBuffer, org.eclipse.jetty.http2.ErrorCode, .Flags, .RateControl, org.eclipse.jetty.http2.frames.DataFrame, .Frame, .FrameType, .GoAwayFrame, .HeadersFrame, .PingFrame, .PriorityFrame, .PushPromiseFrame, .ResetFrame, .SettingsFrame, .WindowUpdateFrame, org.eclipse.jetty.http2.hpack.HpackDecoder, org.eclipse.jetty.io.ByteBufferPool, org.eclipse.jetty.util.NanoTime, org.slf4j.Logger, .LoggerFactory

The HTTP/2 protocol parser.

This parser makes use of the HeaderParser and of BodyParsers to parse HTTP/2 frames.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
private static enum

Field Summary

Modifier and TypeField and Description
private long
private final BodyParser[]
private final ByteBufferPool
private boolean
private final HeaderParser
private final HpackDecoder
private Parser.Listener
private static final Logger
private int
private int
private boolean
private Parser.State
private UnknownBodyParser

Constructor Summary

AccessConstructor and Description
public
Parser(ByteBufferPool bufferPool, int maxHeaderSize)

public
Parser(ByteBufferPool bufferPool, int maxHeaderSize, RateControl rateControl)

Method Summary

Modifier and TypeMethod and Description
private void
private boolean
public long
protected int
public HpackDecoder
protected Parser.Listener
public int
public int
protected boolean
hasFlag(int bit)

public void
init(Parser.Listener listener)

protected void
notifyConnectionFailure(int error, String reason)

public void
parse(ByteBuffer
the buffer to parse
buffer
)

Parses the given buffer bytes and emit events to a Listener.

protected boolean
protected boolean
private void
public void
setMaxFrameSize(int maxFrameSize)

public void
setMaxSettingsKeys(int maxSettingsKeys)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beginNanoTimeback to summary
private long beginNanoTime
bodyParsersback to summary
private final BodyParser[] bodyParsers
bufferPoolback to summary
private final ByteBufferPool bufferPool
continuationback to summary
private boolean continuation
headerParserback to summary
private final HeaderParser headerParser
hpackDecoderback to summary
private final HpackDecoder hpackDecoder
listenerback to summary
private Parser.Listener listener
LOGback to summary
private static final Logger LOG
maxFrameSizeback to summary
private int maxFrameSize
maxSettingsKeysback to summary
private int maxSettingsKeys
nanoTimeStoredback to summary
private boolean nanoTimeStored
stateback to summary
private Parser.State state
unknownBodyParserback to summary
private UnknownBodyParser unknownBodyParser

Constructor Detail

Parserback to summary
public Parser(ByteBufferPool bufferPool, int maxHeaderSize)
Parserback to summary
public Parser(ByteBufferPool bufferPool, int maxHeaderSize, RateControl rateControl)

Method Detail

clearBeginNanoTimeback to summary
private void clearBeginNanoTime()
connectionFailureback to summary
private boolean connectionFailure(ByteBuffer buffer, ErrorCode error, String reason)
getBeginNanoTimeback to summary
public long getBeginNanoTime()
getFrameTypeback to summary
protected int getFrameType()
getHpackDecoderback to summary
public HpackDecoder getHpackDecoder()
getListenerback to summary
protected Parser.Listener getListener()
getMaxFrameSizeback to summary
public int getMaxFrameSize()
getMaxSettingsKeysback to summary
public int getMaxSettingsKeys()
hasFlagback to summary
protected boolean hasFlag(int bit)
initback to summary
public void init(Parser.Listener listener)
notifyConnectionFailureback to summary
protected void notifyConnectionFailure(int error, String reason)
parseback to summary
public void parse(ByteBuffer buffer)

Parses the given buffer bytes and emit events to a Listener.

When this method returns, the buffer may not be fully consumed, so invocations to this method should be wrapped in a loop:

while (buffer.hasRemaining())
    parser.parse(buffer);
Parameters
buffer:ByteBuffer

the buffer to parse

parseBodyback to summary
protected boolean parseBody(ByteBuffer buffer)
parseHeaderback to summary
protected boolean parseHeader(ByteBuffer buffer)
resetback to summary
private void reset()
setMaxFrameSizeback to summary
public void setMaxFrameSize(int maxFrameSize)
setMaxSettingsKeysback to summary
public void setMaxSettingsKeys(int maxSettingsKeys)
storeBeginNanoTimeback to summary
private void storeBeginNanoTime()
org.eclipse.jetty.http2.parser back to summary

public Interface Parser.Listener

Known Direct Subinterfaces
org.eclipse.jetty.http2.parser.ServerParser.Listener
Known Direct Implementers
org.eclipse.jetty.http2.parser.Parser.Listener.Wrapper, org.eclipse.jetty.http2.HTTP2Connection, org.eclipse.jetty.http2.HTTP2Session

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Method Summary

Modifier and TypeMethod and Description
public default void
onConnectionFailure(int error, String reason)

public default void
public default void
public default void
public default void
public default void
public default void
public default void
public default void
public default void
onStreamFailure(int streamId, int error, String reason)

public default void

Method Detail

onConnectionFailureback to summary
public default void onConnectionFailure(int error, String reason)
onDataback to summary
public default void onData(DataFrame frame)
onGoAwayback to summary
public default void onGoAway(GoAwayFrame frame)
onHeadersback to summary
public default void onHeaders(HeadersFrame frame)
onPingback to summary
public default void onPing(PingFrame frame)
onPriorityback to summary
public default void onPriority(PriorityFrame frame)
onPushPromiseback to summary
public default void onPushPromise(PushPromiseFrame frame)
onResetback to summary
public default void onReset(ResetFrame frame)
onSettingsback to summary
public default void onSettings(SettingsFrame frame)
onStreamFailureback to summary
public default void onStreamFailure(int streamId, int error, String reason)
onWindowUpdateback to summary
public default void onWindowUpdate(WindowUpdateFrame frame)
org.eclipse.jetty.http2.parser back to summary

public Class Parser.Listener.Wrapper

extends Object
implements Listener
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.http2.parser.Parser.Listener
Known Direct Subclasses
org.eclipse.jetty.http2.parser.ServerParser.Listener.Wrapper

Field Summary

Modifier and TypeField and Description
private final Parser.Listener

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Parser.Listener
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

listenerback to summary
private final Parser.Listener listener

Constructor Detail

Wrapperback to summary
public Wrapper(Parser.Listener listener)

Method Detail

getParserListenerback to summary
public Parser.Listener getParserListener()
onConnectionFailureback to summary
public void onConnectionFailure(int error, String reason)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onConnectionFailure.

Annotations
@Override
onDataback to summary
public void onData(DataFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onData.

Annotations
@Override
onGoAwayback to summary
public void onGoAway(GoAwayFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onGoAway.

Annotations
@Override
onHeadersback to summary
public void onHeaders(HeadersFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onHeaders.

Annotations
@Override
onPingback to summary
public void onPing(PingFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onPing.

Annotations
@Override
onPriorityback to summary
public void onPriority(PriorityFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onPriority.

Annotations
@Override
onPushPromiseback to summary
public void onPushPromise(PushPromiseFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onPushPromise.

Annotations
@Override
onResetback to summary
public void onReset(ResetFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onReset.

Annotations
@Override
onSettingsback to summary
public void onSettings(SettingsFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onSettings.

Annotations
@Override
onStreamFailureback to summary
public void onStreamFailure(int streamId, int error, String reason)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onStreamFailure.

Annotations
@Override
onWindowUpdateback to summary
public void onWindowUpdate(WindowUpdateFrame frame)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onWindowUpdate.

Annotations
@Override
org.eclipse.jetty.http2.parser back to summary

private final Enum Parser.State

extends Enum<Parser.State>
Class Inheritance

Field Summary

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

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Field Detail

BODYback to summary
public static final Parser.State BODY
HEADERback to summary
public static final Parser.State HEADER

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static Parser.State valueOf(String name)
valuesback to summary
public static Parser.State[] values()