better name missed the release! So support deprecated configuration

This commit is contained in:
Greg Wilkins 2012-07-26 17:42:29 +10:00
parent bb0a564f10
commit 1d72a54635
1 changed files with 6 additions and 1 deletions

View File

@ -108,6 +108,7 @@ public class CrossOriginFilter implements Filter
public static final String PREFLIGHT_MAX_AGE_PARAM = "preflightMaxAge"; public static final String PREFLIGHT_MAX_AGE_PARAM = "preflightMaxAge";
public static final String ALLOW_CREDENTIALS_PARAM = "allowCredentials"; public static final String ALLOW_CREDENTIALS_PARAM = "allowCredentials";
public static final String EXPOSED_HEADERS_PARAM = "exposedHeaders"; public static final String EXPOSED_HEADERS_PARAM = "exposedHeaders";
public static final String OLD_CHAIN_PREFLIGHT_PARAM = "forwardPreflight";
public static final String CHAIN_PREFLIGHT_PARAM = "chainPreflight"; public static final String CHAIN_PREFLIGHT_PARAM = "chainPreflight";
private static final String ANY_ORIGIN = "*"; private static final String ANY_ORIGIN = "*";
private static final List<String> SIMPLE_HTTP_METHODS = Arrays.asList("GET", "POST", "HEAD"); private static final List<String> SIMPLE_HTTP_METHODS = Arrays.asList("GET", "POST", "HEAD");
@ -177,7 +178,11 @@ public class CrossOriginFilter implements Filter
exposedHeadersConfig = ""; exposedHeadersConfig = "";
exposedHeaders.addAll(Arrays.asList(exposedHeadersConfig.split(","))); exposedHeaders.addAll(Arrays.asList(exposedHeadersConfig.split(",")));
String chainPreflightConfig = config.getInitParameter(CHAIN_PREFLIGHT_PARAM); String chainPreflightConfig = config.getInitParameter(OLD_CHAIN_PREFLIGHT_PARAM);
if (chainPreflightConfig!=null) // TODO remove this
LOG.warn("DEPRECATED CONFIGURATION: Use "+CHAIN_PREFLIGHT_PARAM+ " instead of "+OLD_CHAIN_PREFLIGHT_PARAM);
else
chainPreflightConfig = config.getInitParameter(CHAIN_PREFLIGHT_PARAM);
if (chainPreflightConfig == null) if (chainPreflightConfig == null)
chainPreflightConfig = "true"; chainPreflightConfig = "true";
chainPreflight = Boolean.parseBoolean(chainPreflightConfig); chainPreflight = Boolean.parseBoolean(chainPreflightConfig);