Fix compile error
This commit is contained in:
parent
75b0360867
commit
e0b0a99887
@ -16,8 +16,8 @@
|
||||
package io.netty.example.http.cors;
|
||||
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandlerAdapter;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.handler.codec.http.DefaultHttpResponse;
|
||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||
import io.netty.handler.codec.http.HttpVersion;
|
||||
@ -26,10 +26,10 @@ import io.netty.handler.codec.http.HttpVersion;
|
||||
* A simple handler which will simple return a successful Http
|
||||
* response for any request.
|
||||
*/
|
||||
public class OkResponseHandler extends ChannelHandlerAdapter {
|
||||
public class OkResponseHandler extends SimpleChannelInboundHandler<Object> {
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
final DefaultHttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
|
||||
response.headers().set("custom-response-header", "Some value");
|
||||
ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user