while it's documented that the styling will be lost when both settings for
ServerReport/ServerInfo are set to false... eg by adding this to server.xml:

<Valve className="org.apache.catalina.valves.ErrorReportValve"
showReport=false" showServerInfo="false" />

(and I confirmed this recently)

from looking at the source for ErrorReportValve   for tomcat 7.0.78 it
LOOKS like this would be easy to fix:
(however, I'm neither a tomcat/java/HTML or CSS expert, so there may be
very good reasons this is done this way):

currently:

        StringBuilder sb = new StringBuilder();

        sb.append("<html><head>");
        if(showServerInfo || showReport){
            sb.append("<title>");
            if(showServerInfo) {
                sb.append(ServerInfo.getServerInfo()).append(" - ");
            }
            sb.append(smClient.getString("errorReportValve.errorReport"));
            sb.append("</title>");
            sb.append("<style><!--");
            sb.append(org.apache.catalina.util.TomcatCSS.TOMCAT_CSS);
            sb.append("--></style> ");
        } else {
            sb.append("<title>");
            sb.append(smClient.getString("errorReportValve.errorReport"));
            sb.append("</title>");
        }
        sb.append("</head><body>");

.... it looks to me like simply moving the three lines for style/css/style
outside the If statement would fix this, like so:

        StringBuilder sb = new StringBuilder();

        sb.append("<html><head>");
        if(showServerInfo || showReport){
            sb.append("<title>");
            if(showServerInfo) {
                sb.append(ServerInfo.getServerInfo()).append(" - ");
            }
            sb.append(smClient.getString("errorReportValve.errorReport"));
            sb.append("</title>");
        } else {
            sb.append("<title>");
            sb.append(smClient.getString("errorReportValve.errorReport"));
            sb.append("</title>");
        }
        // move style lines outside of if(showServerInfo || showReport){
section... above
        sb.append("<style><!--");
        sb.append(org.apache.catalina.util.TomcatCSS.TOMCAT_CSS);
        sb.append("--></style> ");
        sb.append("</head><body>");
...

or am I missing (or just ignorant of ) something?

John Palmer

Reply via email to