Skip to content

Commit

Permalink
0003984: cookie setting for load balance that needs it
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed May 30, 2019
1 parent e97e810 commit 4a734c2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Expand Up @@ -41,7 +41,9 @@ public class ServerConstants {

public static final String SERVER_ALLOW_DIR_LISTING = "server.allow.dir.list";
public static final String SERVER_ALLOW_HTTP_METHODS = "server.allow.http.methods";
public static final String SERVER_DISALLOW_HTTP_METHODS = "server.disallow.http.methods";
public static final String SERVER_DISALLOW_HTTP_METHODS = "server.disallow.http.methods";

public final static String SERVER_HTTP_COOKIES_ENABLED = "server.http.cookies.enabled";

public final static String STREAM_TO_FILE_ENCRYPT_ENABLED = "stream.to.file.encrypt.enabled";
public final static String STREAM_TO_FILE_COMPRESSION_ENABLED = "stream.to.file.compression.enabled";
Expand Down
Expand Up @@ -53,4 +53,8 @@ jmx.http.enable=true

# Port number for Java Management Extensions (JMX) web console.
#
jmx.http.port=31416
jmx.http.port=31416

# Accept cookies if load balancer requires it for clustering
#
server.http.cookies.enabled=false
Expand Up @@ -21,6 +21,8 @@
package org.jumpmind.symmetric;

import java.lang.management.ManagementFactory;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.util.ArrayList;
import java.util.EnumSet;

Expand Down Expand Up @@ -206,6 +208,12 @@ protected void initFromProperties() {
allowDirListing = serverProperties.get(ServerConstants.SERVER_ALLOW_DIR_LISTING, "false");
allowedMethods = serverProperties.get(ServerConstants.SERVER_ALLOW_HTTP_METHODS, "");
disallowedMethods = serverProperties.get(ServerConstants.SERVER_DISALLOW_HTTP_METHODS, "OPTIONS");

if (serverProperties.is(ServerConstants.SERVER_HTTP_COOKIES_ENABLED, false)) {
if (CookieHandler.getDefault() == null) {
CookieHandler.setDefault(new CookieManager());
}
}
}

public SymmetricWebServer start(int httpPort, int jmxPort, String propertiesUrl) throws Exception {
Expand Down

0 comments on commit 4a734c2

Please sign in to comment.