This handler can be configured using one or more CorsConfig, please
refer to this class for details about the configuration options available.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private CorsConfig | |
| private final List | |
| private final boolean | |
| private static final InternalLogger | |
| private static final String | |
| private HttpRequest |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CorsHandler(final List<CorsConfig>
List of configList, boolean CorsConfigSame as isShortCircuit)CorsConfig#isShortCircuit but applicable to all supplied configs.Creates a new instance with the specified config list. |
| Modifier and Type | Method and Description |
|---|---|
| public void | channelRead(final ChannelHandlerContext ctx, final Object msg)
Overrides io. Implements io. ChannelHandlerContext#fireChannelRead(Object) to forward
to the next ChannelInboundHandler in the ChannelPipeline.
|
| private void | |
| private static void | |
| private CorsConfig | |
| private void | |
| private static boolean | |
| private static void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private static void | |
| private void | |
| private void | |
| private static void | |
| private boolean | |
| private static void | |
| private void | setPreflightHeaders(final HttpResponse
the HttpResponse to which the preflight response headers should be added. response)This is a non CORS specification feature which enables the setting of preflight response headers that might be required by intermediaries. |
| private static void | |
| public void | write(final ChannelHandlerContext
the ctx, final Object ChannelHandlerContext for which the write operation is madethe message to write msg, final ChannelPromise the promise)ChannelPromise to notify once the operation completesOverrides io. Implements io. ChannelHandlerContext#write(Object, ChannelPromise) to forward
to the next ChannelOutboundHandler in the ChannelPipeline.
|
| ANY_ORIGIN | back to summary |
|---|---|
| private static final String ANY_ORIGIN | |
| config | back to summary |
|---|---|
| private CorsConfig config | |
| configList | back to summary |
|---|---|
| private final List<CorsConfig> configList | |
| isShortCircuit | back to summary |
|---|---|
| private final boolean isShortCircuit | |
| logger | back to summary |
|---|---|
| private static final InternalLogger logger | |
| NULL_ORIGIN | back to summary |
|---|---|
| private static final String NULL_ORIGIN | |
| request | back to summary |
|---|---|
| private HttpRequest request | |
| CorsHandler | back to summary |
|---|---|
| public CorsHandler(final CorsConfig config) Creates a new instance with a single | |
| CorsHandler | back to summary |
|---|---|
| public CorsHandler(final List<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.
| |
| channelRead | back to summary |
|---|---|
| public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| echoRequestOrigin | back to summary |
|---|---|
| private void echoRequestOrigin(final HttpResponse response) | |
| forbidden | back to summary |
|---|---|
| private static void forbidden(final ChannelHandlerContext ctx, final HttpRequest request) | |
| getForOrigin | back to summary |
|---|---|
| private CorsConfig getForOrigin(String requestOrigin) | |
| handlePreflight | back to summary |
|---|---|
| private void handlePreflight(final ChannelHandlerContext ctx, final HttpRequest request) | |
| isPreflightRequest | back to summary |
|---|---|
| private static boolean isPreflightRequest(final HttpRequest request) | |
| respond | back to summary |
|---|---|
| private static void respond(final ChannelHandlerContext ctx, final HttpRequest request, final HttpResponse response) | |
| setAllowCredentials | back to summary |
|---|---|
| private void setAllowCredentials(final HttpResponse response) | |
| setAllowHeaders | back to summary |
|---|---|
| private void setAllowHeaders(final HttpResponse response) | |
| setAllowMethods | back to summary |
|---|---|
| private void setAllowMethods(final HttpResponse response) | |
| setAllowPrivateNetwork | back to summary |
|---|---|
| private void setAllowPrivateNetwork(final HttpResponse response) | |
| setAnyOrigin | back to summary |
|---|---|
| private static void setAnyOrigin(final HttpResponse response) | |
| setExposeHeaders | back to summary |
|---|---|
| private void setExposeHeaders(final HttpResponse response) | |
| setMaxAge | back to summary |
|---|---|
| private void setMaxAge(final HttpResponse response) | |
| setNullOrigin | back to summary |
|---|---|
| private static void setNullOrigin(final HttpResponse response) | |
| setOrigin | back to summary |
|---|---|
| private boolean setOrigin(final HttpResponse response) | |
| setOrigin | back to summary |
|---|---|
| private static void setOrigin(final HttpResponse response, final String origin) | |
| setPreflightHeaders | back to summary |
|---|---|
| private void setPreflightHeaders(final HttpResponse response) This is a non CORS specification feature which enables the setting of preflight response headers that might be required by intermediaries.
| |
| setVaryHeader | back to summary |
|---|---|
| private static void setVaryHeader(final HttpResponse response) | |
| write | back to summary |
|---|---|
| public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception Overrides io. Implements io. Doc from io. Calls
| |