Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ in the following tables, are the values that are used when the environment varia
| SHARED_CLASSPATH_DIR | /usr/local/tomcat/shared/classes | |
| TOMCAT_PORT | 8080 | non SSL port tomcat is listening on |
| TOMCAT_PORT_SSL | 8443 | SSL port tomcat is listening on |
| TOMCAT_PORT_PROBE | 8090 | additional non SSL port tomcat is listening on for receiving probes |
| TOMCAT_SERVER_PORT | 8005 | Port for server communication |
| TOMCAT_MAX_HTTP_HEADER_SIZE | 32768 | Maximum http header size |
| TOMCAT_MAX_THREADS | 200 | Maximum number of threads |
| TOMCAT_MAX_THREADS_PROBE | 5 | Maximum number of threads for receiving probes |
| TOMCAT_MAX_PART_COUNT | 100 | Maximum number of parts allowed in a multipart/form-data request. Raise this if legitimate uploads with many form fields/files are being rejected. |
| TOMCAT_MAX_PART_HEADER_SIZE | 1024 | Maximum number of header bytes permitted per part in a multipart/form-data request. Raise this if uploads with long or non-ASCII filenames are being rejected. |
| TOMCAT_MAX_PART_HEADER_SIZE | 1024 | Maximum number of header bytes permitted per part in a multipart/form-data request. Raise this if uploads with long or non-ASCII filenames are being rejected. |
| TOMCAT_ALLOW_CASUAL_MULTIPART_PARSING | false | Set to true if Tomcat should automatically parse multipart/form-data request bodies when HttpServletRequest.getPart* or HttpServletRequest.getParameter* is called. The default is false. |
| TOMCAT_ALLOW_MULTIPLE_LEADING_FORWARD_SLASH_IN_PATH | false | Tomcat will collapse multiple leading / characters at the start of the return value for HttpServletRequest#getContextPath() to a single /. The default is false. |
| TOMCAT_CROSS_CONTEXT | false | Set to true if you want calls within this application to ServletContext.getContext() to successfully return a request dispatcher for other web applications running on this virtual host. Set to false (the default) in security conscious environments, to make getContext() always return null. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public void customize(Tomcat tomcat, TomcatConfiguration configuration) {
.getConfiguration(new DefaultAlfrescoConfigurationProvider()
.getConfiguration(new AlfrescoConfiguration(configuration)));
AlfrescoTomcatFactoryHelper.createGlobalPropertiesFile(alfrescoConfiguration);
AlfrescoTomcatFactoryHelper.createProbeConnector(tomcat, alfrescoConfiguration);
if (alfrescoConfiguration.isSolrSSLEnabled()) {
AlfrescoTomcatFactoryHelper.createSSLConnector(tomcat, alfrescoConfiguration);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,22 @@ public static void createSSLConnector(Tomcat tomcat, AlfrescoConfiguration alfre
connector.setMaxSavePostSize(-1);
tomcat.setConnector(connector);
}

public static void createProbeConnector(Tomcat tomcat, AlfrescoConfiguration alfrescoConfiguration) {
var tomcatConfiguration = alfrescoConfiguration.getTomcatConfiguration();
Connector connector = TomcatFactory.getConnector(tomcat,
"HTTP/1.1",
tomcatConfiguration.getTomcatProbePort(),
false,
"http",
tomcatConfiguration.getTomcatProbeMaxThreads(),
tomcatConfiguration.getTomcatMaxHttpHeaderSize(),
tomcatConfiguration.getTomcatMaxPartCount(),
tomcatConfiguration.getTomcatMaxPartHeaderSize(),
tomcatConfiguration.getTomcatRelaxedPathChars(),
tomcatConfiguration.getTomcatRelaxedQueryChars(),
tomcatConfiguration.isRemoteIpValveEnabled()
);
tomcat.setConnector(connector);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ public TomcatConfiguration getConfiguration(TomcatConfiguration baseConfiguratio
baseConfiguration.setWebappsPath("/usr/local/tomcat/webapps");
baseConfiguration.setTomcatBaseDir("/usr/local/tomcat/temp");
baseConfiguration.setTomcatPort(8080);
baseConfiguration.setTomcatProbePort(8090);
baseConfiguration.setJsonLogging(false);
baseConfiguration.setAccessLogging(false);
baseConfiguration.setSharedLibDir("/usr/local/tomcat/shared/lib");
baseConfiguration.setTomcatMaxThreads(200);
baseConfiguration.setTomcatProbeMaxThreads(5);
baseConfiguration.setTomcatMaxHttpHeaderSize(32768);
baseConfiguration.setTomcatMaxPartCount(100);
baseConfiguration.setTomcatMaxPartHeaderSize(1024);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_BASE_DIR;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_CACHE_MAX_SIZE;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_CROSS_CONTEXT;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_REMOTE_IP_VALVE_ENABLED;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_MAX_HTTP_HEADER_SIZE;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_MAX_PART_COUNT;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_MAX_PART_HEADER_SIZE;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_MAX_THREADS;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_MAX_THREADS_PROBE;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_PORT;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_PORT_PROBE;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_PORT_SSL;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_RELAXED_PATH_CHARS;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_RELAXED_QUERY_CHARS;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_REMOTE_IP_VALVE_ENABLED;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_SERVER_PORT;
import static eu.xenit.alfresco.tomcat.embedded.config.EnvironmentVariables.TOMCAT_WEBAPPS;
import static eu.xenit.alfresco.tomcat.embedded.utils.Utils.setPropertyFromEnv;
Expand All @@ -41,9 +43,11 @@ public TomcatConfiguration getConfiguration(TomcatConfiguration baseConfiguratio
setPropertyFromEnv(GENERATED_CLASSPATH_DIR, baseConfiguration::setGeneratedClasspathDir);
setPropertyFromEnv(TOMCAT_PORT, value -> baseConfiguration.setTomcatPort(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_PORT_SSL, value -> baseConfiguration.setTomcatSslPort(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_PORT_PROBE, value -> baseConfiguration.setTomcatProbePort(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_SERVER_PORT, value -> baseConfiguration.setTomcatServerPort(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_MAX_HTTP_HEADER_SIZE, value -> baseConfiguration.setTomcatMaxHttpHeaderSize(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_MAX_THREADS, value -> baseConfiguration.setTomcatMaxThreads(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_MAX_THREADS_PROBE, value -> baseConfiguration.setTomcatProbeMaxThreads(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_MAX_PART_COUNT, value -> baseConfiguration.setTomcatMaxPartCount(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_MAX_PART_HEADER_SIZE, value -> baseConfiguration.setTomcatMaxPartHeaderSize(Integer.parseInt(value)));
setPropertyFromEnv(TOMCAT_RELAXED_QUERY_CHARS, baseConfiguration::setTomcatRelaxedQueryChars);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ public class EnvironmentVariables {
public static final String TOMCAT_PORT = "TOMCAT_PORT";
public static final String TOMCAT_BASE_DIR = "TOMCAT_BASE_DIR";
public static final String TOMCAT_PORT_SSL = "TOMCAT_PORT_SSL";
public static final String TOMCAT_PORT_PROBE = "TOMCAT_PORT_PROBE";
public static final String TOMCAT_SERVER_PORT = "TOMCAT_SERVER_PORT";
public static final String TOMCAT_MAX_HTTP_HEADER_SIZE = "TOMCAT_MAX_HTTP_HEADER_SIZE";
public static final String TOMCAT_MAX_THREADS = "TOMCAT_MAX_THREADS";
public static final String TOMCAT_MAX_THREADS_PROBE = "TOMCAT_MAX_THREADS_PROBE";
public static final String TOMCAT_MAX_PART_COUNT = "TOMCAT_MAX_PART_COUNT";
public static final String TOMCAT_MAX_PART_HEADER_SIZE = "TOMCAT_MAX_PART_HEADER_SIZE";
public static final String TOMCAT_RELAXED_QUERY_CHARS = "TOMCAT_RELAXED_QUERY_CHARS";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ public class TomcatConfiguration {
protected String tomcatBaseDir;
protected int tomcatPort;
protected int tomcatSslPort;
protected int tomcatProbePort;
protected String sharedClasspathDir;
protected String sharedLibDir;
protected boolean jsonLogging;
protected boolean accessLogging;
protected int tomcatMaxThreads;
protected int tomcatProbeMaxThreads;
protected int tomcatMaxHttpHeaderSize;
protected int tomcatMaxPartCount;
protected int tomcatMaxPartHeaderSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ void testGetConfiguration() {
expected.setAccessLogging(false);
expected.setSharedLibDir("/usr/local/tomcat/shared/lib");
expected.setTomcatMaxThreads(200);
expected.setTomcatProbeMaxThreads(5);
expected.setTomcatMaxHttpHeaderSize(32768);
expected.setTomcatMaxPartCount(100);
expected.setTomcatMaxPartHeaderSize(1024);
expected.setTomcatSslPort(8443);
expected.setTomcatProbePort(8090);
expected.setTomcatServerPort(8005);
expected.setExitOnFailure(true);
expected.setAlfrescoEnabled(false);
Expand All @@ -31,7 +33,7 @@ void testGetConfiguration() {
expected.setAllowMultipleLeadingForwardSlashInPath(false);
expected.setCrossContext(false);
expected.setRemoteIpValveEnabled(true);
assertEquals(configuration, expected);
assertEquals(expected, configuration);
}


Expand Down
Loading