List of usage examples for io.netty.handler.codec.http FullHttpResponse retain
@Override FullHttpResponse retain();
From source file:br.unifei.edu.eco009.steamlansync.proxy.HttpResponseContent.java
public FullHttpResponse getFullResponse() { ByteBuf buffer = Unpooled.copiedBuffer(bytes); FullHttpResponse newResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, buffer);/*from w w w . j a v a 2 s. co m*/ if (length != null) newResponse.headers().add("Content-Length", length); if (steam_sid != null) newResponse.headers().add("x-steam-sid", steam_sid); if (crc != null) newResponse.headers().add("x-content-crc", crc); newResponse.headers().add("content-type", "application/x-steam-chunk"); return newResponse.retain(); }
From source file:org.apache.hadoop.hdfs.server.datanode.web.dtp.Http2ResponseHandler.java
License:Apache License
@Override protected void channelRead0(ChannelHandlerContext ctx, FullHttpResponse msg) throws Exception { Integer streamId = msg.headers().getInt(HttpUtil.ExtensionHeaderNames.STREAM_ID.text()); if (streamId == null) { System.err.println("HttpResponseHandler unexpected message received: " + msg); return;/*w w w . j a v a2 s . c om*/ } if (streamId.intValue() == 1) { // this is the upgrade response message, just ignore it. return; } Promise<FullHttpResponse> promise; synchronized (this) { promise = streamId2Promise.get(streamId); } if (promise == null) { System.err.println("Message received for unknown stream id " + streamId); } else { // Do stuff with the message (for now just print it) promise.setSuccess(msg.retain()); } }