List of usage examples for io.netty.handler.codec.http2 Http2Headers contains
boolean contains(K name, V value);
From source file:io.vertx.core.http.impl.Http2ServerConnection.java
License:Open Source License
@Override public synchronized void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endOfStream) { VertxHttp2Stream stream = streams.get(streamId); if (stream == null) { if (isMalformedRequest(headers)) { handler.writeReset(streamId, Http2Error.PROTOCOL_ERROR.code()); return; }//from ww w .j av a2s. c o m String contentEncoding = options.isCompressionSupported() ? HttpUtils.determineContentEncoding(headers) : null; Http2Stream s = handler.connection().stream(streamId); boolean writable = handler.encoder().flowController().isWritable(s); Http2ServerRequestImpl req = new Http2ServerRequestImpl(this, s, metrics, serverOrigin, headers, contentEncoding, writable); stream = req; CharSequence value = headers.get(HttpHeaderNames.EXPECT); if (options.isHandle100ContinueAutomatically() && ((value != null && HttpHeaderValues.CONTINUE.equals(value)) || headers.contains(HttpHeaderNames.EXPECT, HttpHeaderValues.CONTINUE))) { req.response().writeContinue(); } streams.put(streamId, req); context.executeFromIO(() -> { Http2ServerResponseImpl resp = req.response(); resp.beginRequest(); requestHandler.handle(req); boolean hasPush = resp.endRequest(); if (hasPush) { ctx.flush(); } }); } else { // Http server request trailer - not implemented yet (in api) } if (endOfStream) { context.executeFromIO(stream::onEnd); } }