Class CorsHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
org.infinispan.rest.CorsHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

public class CorsHandler extends io.netty.channel.ChannelDuplexHandler
Handles Cross Origin Resource Sharing (CORS) requests.

This handler can be configured using one or more CorsConfig, please refer to this class for details about the configuration options available. NOTE: This class should be removed after https://github.com/netty/netty/issues/10381 is solved.

  • Nested Class Summary Link icon

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

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    CorsHandler(io.netty.handler.codec.http.cors.CorsConfig config)
    Creates a new instance with a single CorsConfig.
    CorsHandler(List<io.netty.handler.codec.http.cors.CorsConfig> configList, boolean isShortCircuit)
    Creates a new instance with the specified config list.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     
    void
    write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
     

    Methods inherited from class io.netty.channel.ChannelDuplexHandler Link icon

    bind, close, connect, deregister, disconnect, flush, read

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter Link icon

    channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter Link icon

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object Link icon

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

    Methods inherited from interface io.netty.channel.ChannelHandler Link icon

    handlerAdded, handlerRemoved
  • Constructor Details Link icon

    • CorsHandler Link icon

      public CorsHandler(io.netty.handler.codec.http.cors.CorsConfig config)
      Creates a new instance with a single CorsConfig.
    • CorsHandler Link icon

      public CorsHandler(List<io.netty.handler.codec.http.cors.CorsConfig> configList, boolean isShortCircuit)
      Creates a new instance with the specified config list. If more than one config matches a certain origin, the first in the List will be used.
      Parameters:
      configList - List of CorsConfig
      isShortCircuit - Same as CorsConfig.shortCircuit but applicable to all supplied configs.
  • Method Details Link icon

    • channelRead Link icon

      public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • write Link icon

      public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) throws Exception
      Specified by:
      write in interface io.netty.channel.ChannelOutboundHandler
      Overrides:
      write in class io.netty.channel.ChannelDuplexHandler
      Throws:
      Exception