public final class Netty3CorsConfigBuilder
extends java.lang.Object
Netty3CorsConfig instance.
This class was lifted from the Netty project:
https://github.com/netty/netty| Modifier and Type | Method and Description |
|---|---|
Netty3CorsConfigBuilder |
allowCredentials()
By default cookies are not included in CORS requests, but this method will enable cookies to
be added to CORS requests.
|
Netty3CorsConfigBuilder |
allowedRequestHeaders(java.util.Set<java.lang.String> headers)
Specifies the if headers that should be returned in the CORS 'Access-Control-Allow-Headers'
response header.
|
Netty3CorsConfigBuilder |
allowedRequestMethods(java.util.Set<org.jboss.netty.handler.codec.http.HttpMethod> methods)
Specifies the allowed set of HTTP Request Methods that should be returned in the
CORS 'Access-Control-Request-Method' response header.
|
Netty3CorsConfig |
build()
Builds a
Netty3CorsConfig with settings specified by previous method calls. |
Netty3CorsConfigBuilder |
disable()
Disables CORS support.
|
static Netty3CorsConfigBuilder |
forAnyOrigin()
Creates a Builder instance with it's origin set to '*'.
|
static Netty3CorsConfigBuilder |
forOrigin(java.lang.String origin)
Creates a
Netty3CorsConfigBuilder instance with the specified origin. |
static Netty3CorsConfigBuilder |
forOrigins(java.lang.String... origins)
Creates a
Netty3CorsConfigBuilder instance with the specified origins. |
static Netty3CorsConfigBuilder |
forPattern(java.util.regex.Pattern pattern)
Create a
Netty3CorsConfigBuilder instance with the specified pattern origin. |
Netty3CorsConfigBuilder |
maxAge(long max)
When making a preflight request the client has to perform two request with can be inefficient.
|
Netty3CorsConfigBuilder |
noPreflightResponseHeaders()
Specifies that no preflight response headers should be added to a preflight response.
|
<T> Netty3CorsConfigBuilder |
preflightResponseHeader(java.lang.CharSequence name,
java.util.concurrent.Callable<T> valueGenerator)
Returns HTTP response headers that should be added to a CORS preflight response.
|
<T> Netty3CorsConfigBuilder |
preflightResponseHeader(java.lang.CharSequence name,
java.lang.Iterable<T> value)
Returns HTTP response headers that should be added to a CORS preflight response.
|
Netty3CorsConfigBuilder |
preflightResponseHeader(java.lang.CharSequence name,
java.lang.Object... values)
Returns HTTP response headers that should be added to a CORS preflight response.
|
Netty3CorsConfigBuilder |
shortCircuit()
Specifies that a CORS request should be rejected if it's invalid before being
further processing.
|
public static Netty3CorsConfigBuilder forAnyOrigin()
public static Netty3CorsConfigBuilder forOrigin(java.lang.String origin)
Netty3CorsConfigBuilder instance with the specified origin.Netty3CorsConfigBuilder to support method chaining.public static Netty3CorsConfigBuilder forPattern(java.util.regex.Pattern pattern)
Netty3CorsConfigBuilder instance with the specified pattern origin.pattern - the regular expression pattern to match incoming origins on.Netty3CorsConfigBuilder with the configured origin pattern.public static Netty3CorsConfigBuilder forOrigins(java.lang.String... origins)
Netty3CorsConfigBuilder instance with the specified origins.Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfigBuilder disable()
Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfigBuilder allowCredentials()
xhr.withCredentials = true;The default value for 'withCredentials' is false in which case no cookies are sent. Setting this to true will included cookies in cross origin requests.
Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfigBuilder maxAge(long max)
max - the maximum time, in seconds, that the preflight response may be cached.Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfigBuilder allowedRequestMethods(java.util.Set<org.jboss.netty.handler.codec.http.HttpMethod> methods)
methods - the HttpMethods that should be allowed.Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfigBuilder allowedRequestHeaders(java.util.Set<java.lang.String> headers)
xhr.setRequestHeader('My-Custom-Header', "SomeValue");
the server will receive the above header name in the 'Access-Control-Request-Headers' of the
preflight request. The server will then decide if it allows this header to be sent for the
real request (remember that a preflight is not the real request but a request asking the server
if it allow a request).headers - the headers to be added to the preflight 'Access-Control-Allow-Headers' response header.Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfigBuilder preflightResponseHeader(java.lang.CharSequence name, java.lang.Object... values)
name - the name of the HTTP header.values - the values for the HTTP header.Netty3CorsConfigBuilder to support method chaining.public <T> Netty3CorsConfigBuilder preflightResponseHeader(java.lang.CharSequence name, java.lang.Iterable<T> value)
T - the type of values that the Iterable contains.name - the name of the HTTP header.value - the values for the HTTP header.Netty3CorsConfigBuilder to support method chaining.public <T> Netty3CorsConfigBuilder preflightResponseHeader(java.lang.CharSequence name, java.util.concurrent.Callable<T> valueGenerator)
T - the type of the value that the Callable can return.name - the name of the HTTP header.valueGenerator - a Callable which will be invoked at HTTP response creation.Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfigBuilder noPreflightResponseHeaders()
Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfigBuilder shortCircuit()
Netty3CorsConfigBuilder to support method chaining.public Netty3CorsConfig build()
Netty3CorsConfig with settings specified by previous method calls.Netty3CorsConfig the configured CorsConfig instance.