Do not hardcode the "http" scheme, but use that of the request.

This commit is contained in:
Simone Bordet 2015-08-26 11:58:18 +02:00
parent 6c5477de86
commit 874300472e
1 changed files with 3 additions and 4 deletions

View File

@ -34,7 +34,6 @@ 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;
@ -134,7 +133,7 @@ public class DefaultHandler extends AbstractHandler
{ {
writer.write("<li><a href=\""); writer.write("<li><a href=\"");
if (context.getVirtualHosts()!=null && context.getVirtualHosts().length>0) if (context.getVirtualHosts()!=null && context.getVirtualHosts().length>0)
writer.write("http://"+context.getVirtualHosts()[0]+":"+request.getLocalPort()); writer.write(request.getScheme()+"://"+context.getVirtualHosts()[0]+":"+request.getLocalPort());
writer.write(context.getContextPath()); writer.write(context.getContextPath());
if (context.getContextPath().length()>1 && context.getContextPath().endsWith("/")) if (context.getContextPath().length()>1 && context.getContextPath().endsWith("/"))
writer.write("/"); writer.write("/");