diff --git a/pom.xml b/pom.xml
index 9302acb92..ff05c850b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,7 +66,7 @@
1.7.0.1-SNAPSHOT
- 0.3.7
+ 0.3.8-RC6
https://oss.sonatype.org/content/repositories/snapshots
diff --git a/src/main/java/org/codelibs/fess/FessBoot.java b/src/main/java/org/codelibs/fess/FessBoot.java
index 593bc2784..11ea2e26b 100644
--- a/src/main/java/org/codelibs/fess/FessBoot.java
+++ b/src/main/java/org/codelibs/fess/FessBoot.java
@@ -1,23 +1,14 @@
package org.codelibs.fess;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
import org.dbflute.tomcat.TomcatBoot;
public class FessBoot extends TomcatBoot {
- private static final Logger logger = Logger.getLogger(FessBoot.class.getPackage().getName());
+ private static final String FESS_ENV_PROPERTIES = "fess_env.properties";
- private static final String LOGGING_PROPERTIES = "/logging.properties";
+ private static final String LOGGING_PROPERTIES = "logging.properties";
private static final String FESS_CONTEXT_PATH = "fess.context.path";
@@ -31,10 +22,6 @@ public class FessBoot extends TomcatBoot {
private static final String JAVA_IO_TMPDIR = "java.io.tmpdir";
- private static final int DEFAULT_BUF_SIZE = 4096;
-
- private static final String UTF_8 = "UTF-8";
-
public FessBoot(final int port, final String contextPath) {
super(port, contextPath);
}
@@ -63,8 +50,12 @@ public class FessBoot extends TomcatBoot {
}
@Override
- protected void info(final String msg) {
- logger.info(msg);
+ protected void loadServerLoggingIfNeeds() {
+ try {
+ super.loadServerLoggingIfNeeds();
+ } catch (Exception e) {
+ // ignore
+ }
}
// ===================================================================================
@@ -72,38 +63,22 @@ public class FessBoot extends TomcatBoot {
// ============
public static void main(final String[] args) {
- // load logging.properties
- try (InputStream is = FessBoot.class.getResourceAsStream(LOGGING_PROPERTIES)) {
- if (is != null) {
- try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
- final ByteBuffer buffer = ByteBuffer.allocate(DEFAULT_BUF_SIZE);
- final byte[] buf = buffer.array();
- int len;
- while ((len = is.read(buf)) != -1) {
- out.write(buf, 0, len);
- }
-
- String configContent = out.toString(UTF_8);
- final String fessHomeDir = System.getProperty("fess.home");
- if (fessHomeDir != null) {
- configContent = configContent.replaceAll(Pattern.quote("${fess.home}"), fessHomeDir);
- }
-
- LogManager.getLogManager().readConfiguration(new ByteArrayInputStream(configContent.getBytes(UTF_8)));
- logger.info(LOGGING_PROPERTIES + " is loaded.");
- }
- }
- } catch (final IOException e) {
- logger.log(Level.WARNING, "Failed to load " + LOGGING_PROPERTIES, e);
- }
-
// update java.io.tmpdir
final String value = System.getProperty(FESS_TEMP_PATH);
if (value != null) {
System.setProperty(JAVA_IO_TMPDIR, value);
}
- new FessBoot(getPort(), getContextPath()).useTldDetect().asDevelopment(isNoneEnv()).bootAwait();
+ new FessBoot(getPort(), getContextPath()) //
+ .useTldDetect() // for JSP
+ .configure(FESS_ENV_PROPERTIES) // e.g. URIEncoding
+ .logging(LOGGING_PROPERTIES, op -> {
+ final String fessHomeDir = System.getProperty("fess.home");
+ if (fessHomeDir != null) {
+ op.replace("fess.home", fessHomeDir);
+ }
+ }) // uses jdk14logger
+ .asDevelopment(isNoneEnv()).bootAwait();
}
private static boolean isNoneEnv() {
diff --git a/src/main/resources/fess_env.properties b/src/main/resources/fess_env.properties
index 7b68f7850..7aa7f8425 100644
--- a/src/main/resources/fess_env.properties
+++ b/src/main/resources/fess_env.properties
@@ -45,3 +45,8 @@ mail.return.path = root@localhost
# ========================================================================================
# Web
# =====
+# ----------------------------------------------------------
+# Tomcat
+# ------
+tomcat.URIEncoding = UTF-8
+tomcat.useBodyEncodingForURI = true
diff --git a/src/main/resources/fess_env_production.properties b/src/main/resources/fess_env_production.properties
index 2c2c3c788..00561aebb 100644
--- a/src/main/resources/fess_env_production.properties
+++ b/src/main/resources/fess_env_production.properties
@@ -45,3 +45,8 @@ mail.return.path = root@localhost
# ========================================================================================
# Web
# =====
+# ----------------------------------------------------------
+# Tomcat
+# ------
+tomcat.URIEncoding = UTF-8
+tomcat.useBodyEncodingForURI = true