Skip to content

Commit b9f294e

Browse files
authored
Merge pull request #210 from xenit-eu/DOCKER-457_multipart
Adapt default Tomcat 10 configuration
2 parents 781fb61 + a60e2ef commit b9f294e

File tree

3 files changed

+44
-27
lines changed

3 files changed

+44
-27
lines changed

Changelog.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66

77
## released
8-
### Fixed
98

9+
### Fixed
1010
* [PR #118](https://github.com/xenit-eu/docker-alfresco/pull/118) ALFREDOPS-842 upgrade json logging version to 0.0.6
1111
* [PR #112](https://github.com/xenit-eu/docker-alfresco/pull/111) DOCKER-423 SOLR_SSL setting secret does not disable the tomcat ssl connector
1212
* [PR #110](https://github.com/xenit-eu/docker-alfresco/pull/110) XM2C-81 fix alfresco environment and default system properties
13+
* [PR #78](https://github.com/xenit-eu/docker-alfresco/pull/78) DOCKER-408 Add timeout to health check commands
1314

1415
### Added
1516
* [PR #208](https://xenitsupport.jira.com/browse/DOCKER-450) DOCKER-450 Add Alfresco V23.1 & V23.2 support
@@ -32,14 +33,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
3233
* [PR #74](https://github.com/xenit-eu/docker-alfresco/pull/74) DOCKER-406 Added Alfresco 7.2 to subprojects
3334
* [PR #76](https://github.com/xenit-eu/docker-alfresco/pull/76) Allow manual triggers of workflow
3435

35-
### Fixed
36-
37-
* [PR #78](https://github.com/xenit-eu/docker-alfresco/pull/78) DOCKER-408 Add timeout to health check commands
38-
3936
### Changed
40-
41-
* [PR #201](https://github.com/xenit-eu/docker-alfresco/pull/201) XENOPS-1127 Bumped acs packageing version to the latest path version
37+
* [PR #210](https://github.com/xenit-eu/docker-alfresco/pull/210) DOCKER-457 Adapt default context settings for Tomcat 10 (this includes multipart form data parsing)
4238
* [PR #205](https://github.com/xenit-eu/docker-alfresco/pull/205) DOCKER-446 Instead of webscript org/alfresco/enterprise/repository/person/people-enterprise.get, webscript org/alfresco/repository/person/people.get is now used by default to list the Alfresco users in the admin tools.
39+
* [PR #201](https://github.com/xenit-eu/docker-alfresco/pull/201) XENOPS-1127 Bumped acs packageing version to the latest path version
40+
4341

4442
## 2022-02.03 (2022-02-03)
4543

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id "eu.xenit.docker-alfresco" version "5.4.0" apply false
2+
id "eu.xenit.docker-alfresco" version "5.5.0" apply false
33
id "be.vbgn.ci-detect" version "0.5.0"
44
id "org.sonarqube" version "4.3.0.3225"
55
}

tomcat-base/tomcat-embedded-10/src/main/java/eu/xenit/alfresco/tomcat/embedded/tomcat/TomcatFactory.java

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
package eu.xenit.alfresco.tomcat.embedded.tomcat;
22

3+
import static eu.xenit.alfresco.tomcat.embedded.utils.Utils.redirectLog4j;
4+
35
import eu.xenit.alfresco.tomcat.embedded.config.TomcatConfiguration;
46
import eu.xenit.logging.json.valve.JsonAccessLogValve10;
7+
import java.io.IOException;
8+
import java.nio.charset.StandardCharsets;
9+
import java.nio.file.Files;
10+
import java.nio.file.Path;
11+
import java.nio.file.Paths;
12+
import java.util.stream.Stream;
513
import org.apache.catalina.LifecycleException;
614
import org.apache.catalina.LifecycleListener;
715
import org.apache.catalina.Service;
@@ -12,15 +20,6 @@
1220
import org.apache.catalina.webresources.DirResourceSet;
1321
import org.apache.catalina.webresources.StandardRoot;
1422

15-
import java.io.IOException;
16-
import java.nio.charset.StandardCharsets;
17-
import java.nio.file.Files;
18-
import java.nio.file.Path;
19-
import java.nio.file.Paths;
20-
import java.util.stream.Stream;
21-
22-
import static eu.xenit.alfresco.tomcat.embedded.utils.Utils.redirectLog4j;
23-
2423
public class TomcatFactory {
2524

2625
private final TomcatConfiguration configuration;
@@ -29,7 +28,16 @@ public TomcatFactory(TomcatConfiguration configuration) {
2928
this.configuration = configuration;
3029
}
3130

32-
public static Connector getConnector(Tomcat tomcat, String protocol, int port, boolean sslEnabled, String scheme, int maxThreads, int maxHttpHeaderSize, String relaxedPathChars, String relaxedQueryChars) {
31+
public static Connector getConnector(
32+
Tomcat tomcat,
33+
String protocol,
34+
int port,
35+
boolean sslEnabled,
36+
String scheme,
37+
int maxThreads,
38+
int maxHttpHeaderSize,
39+
String relaxedPathChars,
40+
String relaxedQueryChars) {
3341
Connector connector = new Connector(protocol);
3442
connector.setPort(port);
3543
connector.setProperty("connectionTimeout", "240000");
@@ -56,8 +64,16 @@ public Tomcat getTomcat() throws IOException {
5664
tomcat.setPort(getConfiguration().getTomcatPort());
5765
tomcat.getServer().setPort(getConfiguration().getTomcatServerPort());
5866
createDefaultConnector(tomcat);
59-
addUserWithRole(tomcat, "CN=Alfresco Repository Client, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB", null, "repoclient");
60-
addUserWithRole(tomcat, "CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB", null, "repository");
67+
addUserWithRole(
68+
tomcat,
69+
"CN=Alfresco Repository Client, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB",
70+
null,
71+
"repoclient");
72+
addUserWithRole(
73+
tomcat,
74+
"CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB",
75+
null,
76+
"repository");
6177
Path webapps = Paths.get(getConfiguration().getWebappsPath());
6278
if (Files.exists(webapps)) {
6379
try (var directoryStream = Files.newDirectoryStream(webapps)) {
@@ -93,9 +109,12 @@ private void addWebapp(Tomcat tomcat, Path path) {
93109
if (event.getType().equals("before_start")) {
94110
WebResourceRoot resources = new StandardRoot(ctx);
95111
resources.setCacheMaxSize(getConfiguration().getTomcatCacheMaxSize());
96-
resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes", getConfiguration().getSharedClasspathDir(), "/"));
97-
resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes", getConfiguration().getGeneratedClasspathDir(), "/"));
98-
resources.addJarResources(new DirResourceSet(resources, "/WEB-INF/lib", getConfiguration().getSharedLibDir(), "/"));
112+
resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes",
113+
getConfiguration().getSharedClasspathDir(), "/"));
114+
resources.addPostResources(new DirResourceSet(resources, "/WEB-INF/classes",
115+
getConfiguration().getGeneratedClasspathDir(), "/"));
116+
resources.addJarResources(
117+
new DirResourceSet(resources, "/WEB-INF/lib", getConfiguration().getSharedLibDir(), "/"));
99118
if (getConfiguration().isJsonLogging()) {
100119
redirectLog4j(path, Paths.get(configuration.getGeneratedClasspathDir()));
101120
}
@@ -112,6 +131,10 @@ private void addWebapp(Tomcat tomcat, Path path) {
112131
ctx.addValve(valve);
113132
ctx.getAccessLog();
114133
}
134+
135+
ctx.setAllowCasualMultipartParsing(true);
136+
ctx.setAllowMultipleLeadingForwardSlashInPath(true);
137+
ctx.setCrossContext(true);
115138
}
116139
}
117140

@@ -135,7 +158,6 @@ private void addUserWithRole(Tomcat tomcat, String username, String password, St
135158
tomcat.addRole(username, role);
136159
}
137160

138-
139161
private void stopTomcat(Tomcat tomcat) {
140162
Thread thread = new Thread(() -> {
141163
try {
@@ -146,8 +168,5 @@ private void stopTomcat(Tomcat tomcat) {
146168
}
147169
});
148170
thread.start();
149-
150171
}
151-
152-
153172
}

0 commit comments

Comments
 (0)