Jelajahi Sumber

add tomcat_config.properties

Shinsuke Sugaya 9 tahun lalu
induk
melakukan
ea112ae4be

+ 2 - 0
pom.xml

@@ -556,6 +556,8 @@
 			<groupId>org.dbflute.tomcat</groupId>
 			<artifactId>tomcat-boot</artifactId>
 			<version>${tomcat.boot.version}</version>
+			<!-- Disable scope at development on IDEA -->
+			<scope>provided</scope>
 		</dependency>
 
 		<!-- test -->

+ 1 - 0
src/main/assemblies/files/fess.in.sh

@@ -80,4 +80,5 @@ FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dfess.log.name=$APP_NAME"
 FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dfess.log.path=$FESS_HOME/logs"
 FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dfess.log.level=info"
 FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dlasta.env=production"
+FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dtomcat.config.path=tomcat_config.properties"
 

+ 9 - 0
src/main/assemblies/files/tomcat_config.properties

@@ -0,0 +1,9 @@
+# ========================================================================================
+#                                                                                     Web
+#                                                                                    =====
+# ----------------------------------------------------------
+#                                                     Tomcat
+#                                                     ------
+tomcat.URIEncoding = UTF-8
+tomcat.useBodyEncodingForURI = true
+

+ 1 - 0
src/main/assemblies/package.xml

@@ -51,6 +51,7 @@
 			<directory>${project.basedir}/src/main/assemblies/files</directory>
 			<includes>
 				<include>logging.properties</include>
+				<include>tomcat_config.properties</include>
 			</includes>
 			<outputDirectory>fess-${project.version}/lib/classes</outputDirectory>
 		</fileSet>

+ 19 - 12
src/main/java/org/codelibs/fess/FessBoot.java

@@ -6,8 +6,6 @@ import org.dbflute.tomcat.TomcatBoot;
 
 public class FessBoot extends TomcatBoot {
 
-    private static final String FESS_ENV_PROPERTIES = "fess_env.properties";
-
     private static final String LOGGING_PROPERTIES = "logging.properties";
 
     private static final String FESS_CONTEXT_PATH = "fess.context.path";
@@ -22,6 +20,8 @@ public class FessBoot extends TomcatBoot {
 
     private static final String JAVA_IO_TMPDIR = "java.io.tmpdir";
 
+    private static final String TOMCAT_CONFIG_PATH = "tomcat.config.path";
+
     public FessBoot(final int port, final String contextPath) {
         super(port, contextPath);
     }
@@ -60,16 +60,19 @@ public class FessBoot extends TomcatBoot {
             System.setProperty(JAVA_IO_TMPDIR, value);
         }
 
-        new FessBoot(getPort(), getContextPath()) //
-                .useTldDetect() // for JSP
-                .configure(FESS_ENV_PROPERTIES) // e.g. URIEncoding
-                .logging(LOGGING_PROPERTIES, op -> {
-                    op.ignoreNoFile();
-                    final String fessHomeDir = System.getProperty("fess.home");
-                    if (fessHomeDir != null) {
-                        op.replace("fess.home", fessHomeDir);
-                    }
-                }) // uses jdk14logger
+        final String tomcatConfigPath = getTomcatConfigPath();
+        TomcatBoot tomcatBoot = new FessBoot(getPort(), getContextPath()) //
+                .useTldDetect(); // for JSP
+        if (tomcatConfigPath != null) {
+            tomcatBoot.configure(tomcatConfigPath); // e.g. URIEncoding
+        }
+        tomcatBoot.logging(LOGGING_PROPERTIES, op -> {
+            op.ignoreNoFile();
+            final String fessHomeDir = System.getProperty("fess.home");
+            if (fessHomeDir != null) {
+                op.replace("fess.home", fessHomeDir);
+            }
+        }) // uses jdk14logger
                 .asDevelopment(isNoneEnv()).bootAwait();
     }
 
@@ -92,4 +95,8 @@ public class FessBoot extends TomcatBoot {
         }
         return "/fess";
     }
+
+    protected static String getTomcatConfigPath() {
+        return System.getProperty(TOMCAT_CONFIG_PATH);
+    }
 }

+ 1 - 5
src/main/resources/fess_env.properties

@@ -45,8 +45,4 @@ mail.return.path = root@localhost
 # ========================================================================================
 #                                                                                     Web
 #                                                                                    =====
-# ----------------------------------------------------------
-#                                                     Tomcat
-#                                                     ------
-tomcat.URIEncoding = UTF-8
-tomcat.useBodyEncodingForURI = true
+

+ 1 - 5
src/main/resources/fess_env_production.properties

@@ -44,8 +44,4 @@ mail.return.path = root@localhost
 # ========================================================================================
 #                                                                                     Web
 #                                                                                    =====
-# ----------------------------------------------------------
-#                                                     Tomcat
-#                                                     ------
-tomcat.URIEncoding = UTF-8
-tomcat.useBodyEncodingForURI = true
+