You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mi...@apache.org on 2019/11/08 22:49:23 UTC

[tomcat] branch master updated: BZ 63905: Clean up Tomcat CSS

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 69602cb  BZ 63905: Clean up Tomcat CSS
69602cb is described below

commit 69602cb1ef0dc3aa2188a1b3be9fa3a1440cd1b1
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Nov 7 22:21:27 2019 +0100

    BZ 63905: Clean up Tomcat CSS
    
    Remove duplication in Tomcat CSS and align its usage which applies to
    ErrorReportValve, and several servlets. Also update update incorrect
    documentation as well.
---
 java/org/apache/catalina/servlets/DefaultServlet.java | 16 ++++++++++------
 java/org/apache/catalina/util/TomcatCSS.java          | 16 +++++++---------
 webapps/docs/changelog.xml                            |  3 +++
 webapps/docs/config/valve.xml                         |  5 ++---
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java
index c217cf6..2883f5c 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1815,14 +1815,18 @@ public class DefaultServlet extends HttpServlet {
         String rewrittenContextPath =  rewriteUrl(contextPath);
 
         // Render the page header
-        sb.append("<html>\r\n");
+        sb.append("<!doctype html><html>\r\n");
+        /* TODO Activate this as soon as we use smClient with the request locales
+        sb.append("<!doctype html><html lang=\"");
+        sb.append(smClient.getLocale().getLanguage()).append("\">\r\n");
+        */
         sb.append("<head>\r\n");
         sb.append("<title>");
         sb.append(sm.getString("directory.title", directoryWebappPath));
         sb.append("</title>\r\n");
-        sb.append("<STYLE><!--");
+        sb.append("<style>");
         sb.append(org.apache.catalina.util.TomcatCSS.TOMCAT_CSS);
-        sb.append("--></STYLE> ");
+        sb.append("</style> ");
         sb.append("</head>\r\n");
         sb.append("<body>");
         sb.append("<h1>");
@@ -1852,7 +1856,7 @@ public class DefaultServlet extends HttpServlet {
         }
 
         sb.append("</h1>");
-        sb.append("<HR size=\"1\" noshade=\"noshade\">");
+        sb.append("<hr class=\"line\">");
 
         sb.append("<table width=\"100%\" cellspacing=\"0\"" +
                      " cellpadding=\"5\" align=\"center\">\r\n");
@@ -1949,12 +1953,12 @@ public class DefaultServlet extends HttpServlet {
         // Render the page footer
         sb.append("</table>\r\n");
 
-        sb.append("<HR size=\"1\" noshade=\"noshade\">");
+        sb.append("<hr class=\"line\">");
 
         String readme = getReadme(resource, encoding);
         if (readme!=null) {
             sb.append(readme);
-            sb.append("<HR size=\"1\" noshade=\"noshade\">");
+            sb.append("<hr class=\"line\">");
         }
 
         if (showServerInfo) {
diff --git a/java/org/apache/catalina/util/TomcatCSS.java b/java/org/apache/catalina/util/TomcatCSS.java
index c4f6da3..93f15a9 100644
--- a/java/org/apache/catalina/util/TomcatCSS.java
+++ b/java/org/apache/catalina/util/TomcatCSS.java
@@ -22,15 +22,13 @@ package org.apache.catalina.util;
 public class TomcatCSS {
 
     public static final String TOMCAT_CSS =
-        "h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} " +
-        "h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} " +
-        "h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} " +
-        "body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} " +
-        "b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} " +
-        "p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} " +
+        "body {font-family:Tahoma,Arial,sans-serif;} " +
+        "h1, h2, h3, b {color:white;background-color:#525D76;} " +
+        "h1 {font-size:22px;} " +
+        "h2 {font-size:16px;} " +
+        "h3 {font-size:14px;} " +
+        "p {font-size:12px;} " +
         "a {color:black;} " +
-        "a.name {color:black;} " +
         ".line {height:1px;background-color:#525D76;border:none;}";
 
-
-}
\ No newline at end of file
+}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c910d17..0e701f3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -70,6 +70,9 @@
         to this change it was possible to see an updated last modified time but
         the content would be that prior to the modification. (markt)
       </fix>
+      <update>
+        <bug>63905</bug> Clean up Tomcat CSS. (michaelo)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Coyote">
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index 5e05287..72f0584 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -1900,8 +1900,7 @@
     status codes and/or exception types.</p>
 
     <p><strong>NOTE:</strong> Disabling both showServerInfo and showReport will
-    only return the HTTP status code and remove all CSS from the default
-    response.</p>
+    only return the HTTP status code.</p>
 
   </subsection>
 
@@ -1922,7 +1921,7 @@
         <p>The location of the UTF-8 encoded HTML file to return for the HTTP
         error code represented by <code>nnn</code>. For example,
         <code>errorCode.404</code> specifies the file to return for an HTTP 404
-        error. The location may be relative or absolule. If relative, it must be
+        error. The location may be relative or absolute. If relative, it must be
         relative to <code>$CATALINA_BASE</code>. The special value of
         <code>errorCode.0</code> may be used to define a default error page to
         be used if no error page is defined for a status code. If no matching


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [tomcat] branch master updated: BZ 63905: Clean up Tomcat CSS

Posted by Michael Osipov <mi...@apache.org>.
Am 2019-11-13 um 17:41 schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Michael,
> 
> On 11/8/19 17:49, michaelo@apache.org wrote:
>> This is an automated email from the ASF dual-hosted git
>> repository.
>>
>> michaelo pushed a commit to branch master in repository
>> https://gitbox.apache.org/repos/asf/tomcat.git
>>
>>
>> The following commit(s) were added to refs/heads/master by this
>> push: new 69602cb  BZ 63905: Clean up Tomcat CSS 69602cb is
>> described below
>>
>> commit 69602cb1ef0dc3aa2188a1b3be9fa3a1440cd1b1 Author: Michael
>> Osipov <mi...@apache.org> AuthorDate: Thu Nov 7 22:21:27 2019
>> +0100
>>
>> BZ 63905: Clean up Tomcat CSS
>>
>> Remove duplication in Tomcat CSS and align its usage which applies
>> to ErrorReportValve, and several servlets. Also update update
>> incorrect documentation as well. ---
>> java/org/apache/catalina/servlets/DefaultServlet.java | 16
>> ++++++++++------ java/org/apache/catalina/util/TomcatCSS.java
>> | 16 +++++++--------- webapps/docs/changelog.xml
>> |  3 +++ webapps/docs/config/valve.xml                         |  5
>> ++--- 4 files changed, 22 insertions(+), 18 deletions(-)
>>
>> diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java
>> b/java/org/apache/catalina/servlets/DefaultServlet.java index
>> c217cf6..2883f5c 100644 ---
>> a/java/org/apache/catalina/servlets/DefaultServlet.java +++
>> b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1815,14
>> +1815,18 @@ public class DefaultServlet extends HttpServlet {
>> String rewrittenContextPath =  rewriteUrl(contextPath);
>>
>> // Render the page header -        sb.append("<html>\r\n"); +
>> sb.append("<!doctype html><html>\r\n"); +        /* TODO Activate
>> this as soon as we use smClient with the request locales +
>> sb.append("<!doctype html><html lang=\""); +
>> sb.append(smClient.getLocale().getLanguage()).append("\">\r\n"); +
>> */
> 
> Thank you for this. Even though it's not yet active, It's good to have
> it in there as a reminder for the future.
> 
> Do you think it's worth having any \r\n characters in here? Seems like
> just a waste of space on the wire.

I would consider two options:

* Remove line breaks, the browser does not need that
* Use a StringWriter/PrintWriter to produce consistent line breaks on 
the platforms Tomcat runs

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [tomcat] branch master updated: BZ 63905: Clean up Tomcat CSS

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Michael,

On 11/8/19 17:49, michaelo@apache.org wrote:
> This is an automated email from the ASF dual-hosted git
> repository.
> 
> michaelo pushed a commit to branch master in repository
> https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this
> push: new 69602cb  BZ 63905: Clean up Tomcat CSS 69602cb is
> described below
> 
> commit 69602cb1ef0dc3aa2188a1b3be9fa3a1440cd1b1 Author: Michael
> Osipov <mi...@apache.org> AuthorDate: Thu Nov 7 22:21:27 2019
> +0100
> 
> BZ 63905: Clean up Tomcat CSS
> 
> Remove duplication in Tomcat CSS and align its usage which applies
> to ErrorReportValve, and several servlets. Also update update
> incorrect documentation as well. --- 
> java/org/apache/catalina/servlets/DefaultServlet.java | 16
> ++++++++++------ java/org/apache/catalina/util/TomcatCSS.java
> | 16 +++++++--------- webapps/docs/changelog.xml
> |  3 +++ webapps/docs/config/valve.xml                         |  5
> ++--- 4 files changed, 22 insertions(+), 18 deletions(-)
> 
> diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java
> b/java/org/apache/catalina/servlets/DefaultServlet.java index
> c217cf6..2883f5c 100644 ---
> a/java/org/apache/catalina/servlets/DefaultServlet.java +++
> b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1815,14
> +1815,18 @@ public class DefaultServlet extends HttpServlet { 
> String rewrittenContextPath =  rewriteUrl(contextPath);
> 
> // Render the page header -        sb.append("<html>\r\n"); +
> sb.append("<!doctype html><html>\r\n"); +        /* TODO Activate
> this as soon as we use smClient with the request locales +
> sb.append("<!doctype html><html lang=\""); +
> sb.append(smClient.getLocale().getLanguage()).append("\">\r\n"); +
> */

Thank you for this. Even though it's not yet active, It's good to have
it in there as a reminder for the future.

Do you think it's worth having any \r\n characters in here? Seems like
just a waste of space on the wire.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl3MMisACgkQHPApP6U8
pFikpBAAkolAV7dx+erYxAYAjs6jIsRMIdZhjGkRJ+K57b5f1A0UlaimBT5embIW
bYrCDZEpV+1yYW3Ii61ZNZD59gkCVh5eyCxE72s+M3AWvWvgAOepCoj9nbiw3kXq
ac0LCQ/bB2qmLIBc2NGCACYxRNRtmB3aGAC1j9Jnr6MsYGRLIWOyueVKRDVhJjvm
F/F3PDQIy6TWvMXKfgu+JeE38ArB7qVg2UFI7SYTRVw6gvvi/XnngOio4Io8uFv2
Q2iAkeWu0maeCbjDtKOq3YVLiiKXbGsThx/tLITKYk4V12x/TFflpYd5fYFUuMoJ
Mw9HdID3BaIBHOwq3Q4J5t9ocZfT01jsIbjLhD9QIrIqrLCp7PbwzE2DPD4tQlDV
mFk6UI3FI+4SbtJMEy3QdwB4Oj44xogIclwVwUfDx07WrfSLwUmOOwhceLyDkgO+
9azj71HggvovDx0ROQXLzzved3qZIP23N4nNgpDJcj+kP/+0laR6crcfLIGLWR2f
z0ejIjwB0lhTxeheYOPCnGjACcN6h4Dm5+uu08g/QxmCObnzZpORdPJuW2PSlaYy
Dn0h0cuz/vRg/Z+4nEve9GBWX7COZNiuOqXwEwoO5OKro2Fzvwj5o3ZqbM7MGRmj
2WViKkuhedYEHFRlfEeZ182/z7OczDX8irbPdYl2k8Vn41O/00Y=
=sEMq
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org