419309 Added symlink checker to test webapp

This commit is contained in:
Greg Wilkins 2013-10-14 11:59:18 +11:00
parent 33b10efcaa
commit ad124b6888
3 changed files with 26 additions and 2 deletions

View File

@ -1722,6 +1722,16 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
{
return _aliasChecks;
}
/* ------------------------------------------------------------ */
/**
* @param checks list of AliasCheck instances
*/
public void setAliasChecks(List<AliasCheck> checks)
{
_aliasChecks.clear();
_aliasChecks.addAll(checks);
}
/* ------------------------------------------------------------ */
/**

View File

@ -29,6 +29,11 @@ detected.
<Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="overrideDescriptor"><Property name="jetty.webapps" default="."/>/test.d/override-web.xml</Set>
<!-- Enable symlinks
<Call name="addAliasCheck">
<Arg><New class="org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker"/></Arg>
</Call>
-->
<!-- virtual hosts
<Set name="virtualHosts">

View File

@ -668,6 +668,11 @@ public class Dump extends HttpServlet
try{pout.write("<td>"+getServletContext().getResourcePaths(res)+"</td>");}
catch(Exception e) {pout.write("<td>"+"" +e+"</td>");}
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\">getServletContext().getRealPath(...):&nbsp;</th>");
try{pout.write("<td>"+getServletContext().getRealPath(res)+"</td>");}
catch(Exception e) {pout.write("<td>"+"" +e+"</td>");}
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\">getServletContext().getContext(...):&nbsp;</th>");
@ -690,8 +695,12 @@ public class Dump extends HttpServlet
if (cp==null || "/".equals(cp))
cp="";
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\">getServletContext().getContext(...),getRequestDispatcher(...):&nbsp;</th>");
pout.write("<td>"+getServletContext().getContext(res).getRequestDispatcher(res.substring(cp.length()))+"</td>");
pout.write("<th align=\"right\">getServletContext().getContext(...).getRequestDispatcher(...):&nbsp;</th>");
pout.write("<td>"+context.getRequestDispatcher(res.substring(cp.length()))+"</td>");
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\">getServletContext().getContext(...).getRealPath(...):&nbsp;</th>");
pout.write("<td>"+context.getRealPath(res.substring(cp.length()))+"</td>");
}
pout.write("</tr><tr>\n");