Skip to content

Commit

Permalink
prevent detailed information on errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nhnb committed Mar 14, 2024
1 parent f309b2e commit a8090ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/marauroa/server/net/web/DetaillessErrorReportValve.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package marauroa.server.net.web;

import org.apache.catalina.valves.ErrorReportValve;

public class DetaillessErrorReportValve extends ErrorReportValve {

public DetaillessErrorReportValve() {
super();
setShowReport(false);
setShowServerInfo(false);
}
}
4 changes: 4 additions & 0 deletions src/marauroa/server/net/web/WebSocketServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.StandardHost;
import org.apache.catalina.startup.ContextConfig;
import org.apache.catalina.startup.Tomcat;
import org.apache.tomcat.util.scan.StandardJarScanner;
Expand Down Expand Up @@ -71,6 +72,9 @@ public static void startWebSocketServer() throws Exception {
connector.setProperty("address", host);
tomcat.setConnector(connector);

StandardHost standardHost = (StandardHost) tomcat.getHost();
standardHost.setErrorReportValveClass("marauroa.server.net.web.DetaillessErrorReportValve");

Context context = tomcat.addContext("", createTemporaryFolder());
StandardJarScanner scan = (StandardJarScanner) context.getJarScanner();
scan.setScanClassPath(true);
Expand Down

0 comments on commit a8090ac

Please sign in to comment.