Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gorovoy2010-05-12 02:39:46 -0400
committerMichael Gorovoy2010-05-12 02:39:46 -0400
commit7b82292ff0994cbb05895f32d73e1c402948b03e (patch)
treea7055282b22ae06b6b32288426da9ef76c28f5c0
parent4d72f12fa10113acbbc65be483c996c0dcfb529b (diff)
downloadorg.eclipse.jetty.project-7b82292ff0994cbb05895f32d73e1c402948b03e.tar.gz
org.eclipse.jetty.project-7b82292ff0994cbb05895f32d73e1c402948b03e.tar.xz
org.eclipse.jetty.project-7b82292ff0994cbb05895f32d73e1c402948b03e.zip
302344 Make the list of available contexts if root context is not configured optional
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1761 7e9141cc-0065-0410-87d8-b60c137991c4
-rw-r--r--VERSION.txt1
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/handler/DefaultHandler.java85
2 files changed, 50 insertions, 36 deletions
diff --git a/VERSION.txt b/VERSION.txt
index d13fa82409..c33d145d15 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1,4 +1,5 @@
jetty-7.1.1-SNAPSHOT
+ + 302344 Make the list of available contexts if root context is not configured optional
+ 304803 Remove TypeUtil Integer and Long caches
+ 308857 Update test suite to JUnit4 - Module jetty-jndi
+ 308856 Update test suite to JUnit4 - Module jetty-jmx
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 232aba637c..073c0dfde9 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
@@ -50,6 +50,7 @@ public class DefaultHandler extends AbstractHandler
final long _faviconModified=(System.currentTimeMillis()/1000)*1000;
byte[] _favicon;
boolean _serveIcon=true;
+ boolean _showContexts=true;
public DefaultHandler()
{
@@ -114,44 +115,47 @@ public class DefaultHandler extends AbstractHandler
writer.write("<HTML>\n<HEAD>\n<TITLE>Error 404 - Not Found");
writer.write("</TITLE>\n<BODY>\n<H2>Error 404 - Not Found.</H2>\n");
writer.write("No context on this server matched or handled this request.<BR>");
- writer.write("Contexts known to this server are: <ul>");
-
-
- Server server = getServer();
- Handler[] handlers = server==null?null:server.getChildHandlersByClass(ContextHandler.class);
-
- for (int i=0;handlers!=null && i<handlers.length;i++)
+
+ if (_showContexts)
{
- ContextHandler context = (ContextHandler)handlers[i];
- if (context.isRunning())
- {
- writer.write("<li><a href=\"");
- if (context.getVirtualHosts()!=null && context.getVirtualHosts().length>0)
- writer.write("http://"+context.getVirtualHosts()[0]+":"+request.getLocalPort());
- writer.write(context.getContextPath());
- if (context.getContextPath().length()>1 && context.getContextPath().endsWith("/"))
- writer.write("/");
- writer.write("\">");
- writer.write(context.getContextPath());
- if (context.getVirtualHosts()!=null && context.getVirtualHosts().length>0)
- writer.write("&nbsp;@&nbsp;"+context.getVirtualHosts()[0]+":"+request.getLocalPort());
- writer.write("&nbsp;--->&nbsp;");
- writer.write(context.toString());
- writer.write("</a></li>\n");
- }
- else
+ writer.write("Contexts known to this server are: <ul>");
+
+ Server server = getServer();
+ Handler[] handlers = server==null?null:server.getChildHandlersByClass(ContextHandler.class);
+
+ for (int i=0;handlers!=null && i<handlers.length;i++)
{
- writer.write("<li>");
- writer.write(context.getContextPath());
- if (context.getVirtualHosts()!=null && context.getVirtualHosts().length>0)
- writer.write("&nbsp;@&nbsp;"+context.getVirtualHosts()[0]+":"+request.getLocalPort());
- writer.write("&nbsp;--->&nbsp;");
- writer.write(context.toString());
- if (context.isFailed())
- writer.write(" [failed]");
- if (context.isStopped())
- writer.write(" [stopped]");
- writer.write("</li>\n");
+ ContextHandler context = (ContextHandler)handlers[i];
+ if (context.isRunning())
+ {
+ writer.write("<li><a href=\"");
+ if (context.getVirtualHosts()!=null && context.getVirtualHosts().length>0)
+ writer.write("http://"+context.getVirtualHosts()[0]+":"+request.getLocalPort());
+ writer.write(context.getContextPath());
+ if (context.getContextPath().length()>1 && context.getContextPath().endsWith("/"))
+ writer.write("/");
+ writer.write("\">");
+ writer.write(context.getContextPath());
+ if (context.getVirtualHosts()!=null && context.getVirtualHosts().length>0)
+ writer.write("&nbsp;@&nbsp;"+context.getVirtualHosts()[0]+":"+request.getLocalPort());
+ writer.write("&nbsp;--->&nbsp;");
+ writer.write(context.toString());
+ writer.write("</a></li>\n");
+ }
+ else
+ {
+ writer.write("<li>");
+ writer.write(context.getContextPath());
+ if (context.getVirtualHosts()!=null && context.getVirtualHosts().length>0)
+ writer.write("&nbsp;@&nbsp;"+context.getVirtualHosts()[0]+":"+request.getLocalPort());
+ writer.write("&nbsp;--->&nbsp;");
+ writer.write(context.toString());
+ if (context.isFailed())
+ writer.write(" [failed]");
+ if (context.isStopped())
+ writer.write(" [stopped]");
+ writer.write("</li>\n");
+ }
}
}
@@ -183,6 +187,15 @@ public class DefaultHandler extends AbstractHandler
{
_serveIcon = serveIcon;
}
+
+ public boolean getShowContexts()
+ {
+ return _showContexts;
+ }
+ public void setShowContexts(boolean show)
+ {
+ _showContexts = show;
+ }
}

Back to the top