Search in sources :

Example 1 with Http2PayloadType

use of com.webpieces.http2engine.impl.shared.data.Http2PayloadType in project webpieces by deanhiller.

the class Level5AStates method translate.

protected Http2Event translate(Http2SendRecieve sendRecv, Http2Msg payload) {
    Http2PayloadType payloadType;
    if (payload instanceof Http2Headers) {
        Http2Headers head = (Http2Headers) payload;
        if (head.isEndOfStream())
            payloadType = Http2PayloadType.HEADERS_EOS;
        else
            payloadType = Http2PayloadType.HEADERS;
    } else if (payload instanceof DataFrame) {
        DataFrame data = (DataFrame) payload;
        if (data.isEndOfStream())
            payloadType = Http2PayloadType.DATA_EOS;
        else
            payloadType = Http2PayloadType.DATA;
    } else if (payload instanceof Http2Push) {
        payloadType = Http2PayloadType.PUSH_PROMISE;
    } else if (payload instanceof CancelReason) {
        payloadType = Http2PayloadType.RESET_STREAM;
    } else
        throw new IllegalArgumentException("unknown payload type for payload=" + payload);
    return Http2Event.lookup(sendRecv, payloadType);
}
Also used : Http2PayloadType(com.webpieces.http2engine.impl.shared.data.Http2PayloadType) CancelReason(com.webpieces.http2parser.api.dto.CancelReason) Http2Headers(com.webpieces.hpack.api.dto.Http2Headers) DataFrame(com.webpieces.http2parser.api.dto.DataFrame) Http2Push(com.webpieces.hpack.api.dto.Http2Push)

Aggregations

Http2Headers (com.webpieces.hpack.api.dto.Http2Headers)1 Http2Push (com.webpieces.hpack.api.dto.Http2Push)1 Http2PayloadType (com.webpieces.http2engine.impl.shared.data.Http2PayloadType)1 CancelReason (com.webpieces.http2parser.api.dto.CancelReason)1 DataFrame (com.webpieces.http2parser.api.dto.DataFrame)1