Class Netty4CorsHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- org.elasticsearch.http.netty4.cors.Netty4CorsHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public class Netty4CorsHandler extends io.netty.channel.ChannelDuplexHandlerHandles Cross Origin Resource Sharing (CORS) requests.This handler can be configured using a
Netty4CorsConfig, please refer to this class for details about the configuration options available. This code was borrowed from Netty 4 and refactored to work for Elasticsearch's Netty 3 setup.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringANY_ORIGIN
-
Constructor Summary
Constructors Constructor Description Netty4CorsHandler(Netty4CorsConfig config)Creates a new instance with the specifiedNetty4CorsConfig.
-
Method Summary
Modifier and Type Method Description voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg)static voidsetCorsResponseHeaders(io.netty.handler.codec.http.HttpRequest request, io.netty.handler.codec.http.HttpResponse resp, Netty4CorsConfig config)-
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read, write
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
ANY_ORIGIN
public static final java.lang.String ANY_ORIGIN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Netty4CorsHandler
public Netty4CorsHandler(Netty4CorsConfig config)
Creates a new instance with the specifiedNetty4CorsConfig.
-
-
Method Detail
-
channelRead
public void channelRead(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
java.lang.Exception
-
setCorsResponseHeaders
public static void setCorsResponseHeaders(io.netty.handler.codec.http.HttpRequest request, io.netty.handler.codec.http.HttpResponse resp, Netty4CorsConfig config)
-
-