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

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String ANY_ORIGIN  
  • Constructor Summary

    Constructors 
    Constructor Description
    Netty4CorsHandler​(CorsHandler.Config config)
    Creates a new instance with the specified CorsHandler.Config.
  • Method Summary

    Modifier and Type Method Description
    void channelRead​(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg)  
    static void setCorsResponseHeaders​(io.netty.handler.codec.http.HttpHeaders headers, io.netty.handler.codec.http.HttpResponse resp, CorsHandler.Config config)  
    void write​(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, read

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Field Details

  • Constructor Details

  • Method Details

    • channelRead

      public void channelRead​(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.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:
      write in interface io.netty.channel.ChannelOutboundHandler
      Overrides:
      write in class io.netty.channel.ChannelDuplexHandler
      Throws:
      java.lang.Exception
    • setCorsResponseHeaders

      public static void setCorsResponseHeaders​(io.netty.handler.codec.http.HttpHeaders headers, io.netty.handler.codec.http.HttpResponse resp, CorsHandler.Config config)