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.ChannelDuplexHandler
Handles Cross Origin Resource Sharing (CORS) requests.
This handler can be configured using a CorsHandler.Config, please
refer to this class for details about the configuration options available.
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringANY_ORIGIN -
Constructor Summary
Constructors Constructor Description Netty4CorsHandler(CorsHandler.Config config)Creates a new instance with the specifiedCorsHandler.Config. -
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, CorsHandler.Config config)voidwrite(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.channel.ChannelPromise promise)Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, readMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
Field Details
-
ANY_ORIGIN
public static final java.lang.String ANY_ORIGIN- See Also:
- Constant Field Values
-
-
Constructor Details
-
Netty4CorsHandler
Creates a new instance with the specifiedCorsHandler.Config.
-
-
Method Details
-
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
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.channel.ChannelPromise promise) throws java.lang.Exception- Specified by:
writein interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
writein classio.netty.channel.ChannelDuplexHandler- Throws:
java.lang.Exception
-
setCorsResponseHeaders
public static void setCorsResponseHeaders(io.netty.handler.codec.http.HttpRequest request, io.netty.handler.codec.http.HttpResponse resp, CorsHandler.Config config)
-