From e633189b48fec05b88b51528f283a1f811566907 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 23 Apr 2015 11:07:30 +1000 Subject: [PATCH] 457788 Powered By in o.e.j.util.Jetty --- .../org/eclipse/jetty/http/spi/HttpSpiContextHandler.java | 3 ++- .../src/main/java/org/eclipse/jetty/server/Response.java | 4 +++- .../org/eclipse/jetty/server/handler/DefaultHandler.java | 3 ++- .../java/org/eclipse/jetty/server/handler/ErrorHandler.java | 3 ++- jetty-util/src/main/java/org/eclipse/jetty/util/Jetty.java | 6 ++++++ 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/HttpSpiContextHandler.java b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/HttpSpiContextHandler.java index 57a5b6479f8..03dc87cc6ec 100644 --- a/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/HttpSpiContextHandler.java +++ b/jetty-http-spi/src/main/java/org/eclipse/jetty/http/spi/HttpSpiContextHandler.java @@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.util.Jetty; import com.sun.net.httpserver.Authenticator; import com.sun.net.httpserver.Authenticator.Result; @@ -98,7 +99,7 @@ public class HttpSpiContextHandler extends ContextHandler ex.printStackTrace(writer); writer.println(""); - writer.println("

Powered by jetty://

"); + writer.println("

"+Jetty.POWERED_BY_HTML+"

"); writer.close(); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index bd5b33ca3d9..c0a446b153e 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -53,6 +53,7 @@ import org.eclipse.jetty.http.PreEncodedHttpField; import org.eclipse.jetty.io.RuntimeIOException; import org.eclipse.jetty.server.handler.ErrorHandler; import org.eclipse.jetty.util.ByteArrayISO8859Writer; +import org.eclipse.jetty.util.Jetty; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.URIUtil; @@ -603,7 +604,8 @@ public class Response implements HttpServletResponse writer.write(". Reason:\n
    ");
                     writer.write(message);
                     writer.write("
"); - writer.write("

\n
Powered by Jetty://"); + writer.write("

\n
"); + writer.write(Jetty.POWERED_BY_HTML); writer.write("\n\n\n"); writer.flush(); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java index f6a7899c474..83539ec1181 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java @@ -34,6 +34,7 @@ import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.ByteArrayISO8859Writer; import org.eclipse.jetty.util.IO; +import org.eclipse.jetty.util.Jetty; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.resource.Resource; @@ -164,7 +165,7 @@ public class DefaultHandler extends AbstractHandler writer.write("
"); writer.write(" "); - writer.write("Powered by Jetty:// Java Web Server
\n"); + writer.write(Jetty.POWERED_BY_HTML+"
\n"); writer.write("\n\n\n"); writer.flush(); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java index 24483ab12f9..9a6ae23be88 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java @@ -39,6 +39,7 @@ import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.ByteArrayISO8859Writer; +import org.eclipse.jetty.util.Jetty; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -161,7 +162,7 @@ public class ErrorHandler extends AbstractHandler writeErrorPageMessage(request,writer,code,message,uri); if (showStacks) writeErrorPageStacks(request,writer); - writer.write("
Powered by Jetty://
\n"); + writer.write("
"+Jetty.POWERED_BY_HTML+"
\n"); } /* ------------------------------------------------------------ */ diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Jetty.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Jetty.java index 38fd56d8d04..6130b70b922 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Jetty.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/Jetty.java @@ -21,6 +21,8 @@ package org.eclipse.jetty.util; public class Jetty { public static final String VERSION; + public static final String POWERED_BY; + public static final String POWERED_BY_HTML; static { @@ -31,9 +33,13 @@ public class Jetty VERSION = pkg.getImplementationVersion(); else VERSION = System.getProperty("jetty.version", "9.3.z-SNAPSHOT"); + + POWERED_BY="Powered by Jetty://"+VERSION; + POWERED_BY_HTML=""+POWERED_BY+""; } private Jetty() { } + }