457788 Powered By in o.e.j.util.Jetty

This commit is contained in:
Greg Wilkins 2015-04-23 11:07:30 +10:00
parent deec5291f0
commit e633189b48
5 changed files with 15 additions and 4 deletions

View File

@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.ContextHandler; 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;
import com.sun.net.httpserver.Authenticator.Result; import com.sun.net.httpserver.Authenticator.Result;
@ -98,7 +99,7 @@ public class HttpSpiContextHandler extends ContextHandler
ex.printStackTrace(writer); ex.printStackTrace(writer);
writer.println("</pre>"); writer.println("</pre>");
writer.println("<p><i><small><a href=\"http://eclipse.org/jetty\">Powered by jetty://</a></small></i></p>"); writer.println("<p>"+Jetty.POWERED_BY_HTML+"</p>");
writer.close(); writer.close();
} }

View File

@ -53,6 +53,7 @@ import org.eclipse.jetty.http.PreEncodedHttpField;
import org.eclipse.jetty.io.RuntimeIOException; import org.eclipse.jetty.io.RuntimeIOException;
import org.eclipse.jetty.server.handler.ErrorHandler; import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.util.ByteArrayISO8859Writer; import org.eclipse.jetty.util.ByteArrayISO8859Writer;
import org.eclipse.jetty.util.Jetty;
import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.URIUtil;
@ -603,7 +604,8 @@ public class Response implements HttpServletResponse
writer.write(". Reason:\n<pre> "); writer.write(". Reason:\n<pre> ");
writer.write(message); writer.write(message);
writer.write("</pre>"); writer.write("</pre>");
writer.write("</p>\n<hr /><i><small>Powered by Jetty://</small></i>"); writer.write("</p>\n<hr />");
writer.write(Jetty.POWERED_BY_HTML);
writer.write("\n</body>\n</html>\n"); writer.write("\n</body>\n</html>\n");
writer.flush(); writer.flush();

View File

@ -34,6 +34,7 @@ import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.ByteArrayISO8859Writer; import org.eclipse.jetty.util.ByteArrayISO8859Writer;
import org.eclipse.jetty.util.IO; 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.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.Resource;
@ -164,7 +165,7 @@ public class DefaultHandler extends AbstractHandler
writer.write("</ul><hr>"); writer.write("</ul><hr>");
writer.write("<a href=\"http://eclipse.org/jetty\"><img border=0 src=\"/favicon.ico\"/></a>&nbsp;"); writer.write("<a href=\"http://eclipse.org/jetty\"><img border=0 src=\"/favicon.ico\"/></a>&nbsp;");
writer.write("<a href=\"http://eclipse.org/jetty\">Powered by Jetty:// Java Web Server</a><hr/>\n"); writer.write(Jetty.POWERED_BY_HTML+"<hr/>\n");
writer.write("\n</BODY>\n</HTML>\n"); writer.write("\n</BODY>\n</HTML>\n");
writer.flush(); writer.flush();

View File

@ -39,6 +39,7 @@ import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.ByteArrayISO8859Writer; 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.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
@ -161,7 +162,7 @@ public class ErrorHandler extends AbstractHandler
writeErrorPageMessage(request,writer,code,message,uri); writeErrorPageMessage(request,writer,code,message,uri);
if (showStacks) if (showStacks)
writeErrorPageStacks(request,writer); writeErrorPageStacks(request,writer);
writer.write("<hr><i><small>Powered by Jetty://</small></i><hr/>\n"); writer.write("<hr>"+Jetty.POWERED_BY_HTML+"<hr/>\n");
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -21,6 +21,8 @@ package org.eclipse.jetty.util;
public class Jetty public class Jetty
{ {
public static final String VERSION; public static final String VERSION;
public static final String POWERED_BY;
public static final String POWERED_BY_HTML;
static static
{ {
@ -31,9 +33,13 @@ public class Jetty
VERSION = pkg.getImplementationVersion(); VERSION = pkg.getImplementationVersion();
else else
VERSION = System.getProperty("jetty.version", "9.3.z-SNAPSHOT"); VERSION = System.getProperty("jetty.version", "9.3.z-SNAPSHOT");
POWERED_BY="Powered by Jetty://"+VERSION;
POWERED_BY_HTML="<a href=\"http://eclipse.org/jetty\">"+POWERED_BY+"</a>";
} }
private Jetty() private Jetty()
{ {
} }
} }