bug 341736 some more debugging in the test webapp to probe if getRealPath("/WEB-INF") is a folder and is writeable.

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3082 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Hugues Malphettes 2011-05-06 06:11:28 +00:00
parent 0794637013
commit d18bf7eddc
1 changed files with 50 additions and 0 deletions

View File

@ -589,6 +589,56 @@ public class Dump extends HttpServlet
pout.write("<td>"+ toString(getInitParameter(name)) +"</td>");
}
pout.write("</tr><tr>\n");
pout.write("<th align=\"left\" colspan=\"2\"><big><br/>ServletContext Misc:</big></th>");
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\" valign=\"top\">"+"servletContext.getContextPath()"+":&nbsp;</th>");
pout.write("<td>"+ getServletContext().getContextPath() + "</td>");
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\" valign=\"top\">"+"getServletContext().getRealPath(\"/WEB-INF/\")"+":&nbsp;</th>");
pout.write("<td>"+ getServletContext().getRealPath("/WEB-INF/") + "</td>");
String webinfRealPath = getServletContext().getRealPath("/WEB-INF/");
if (webinfRealPath != null)
{
try
{
File webInfRealPathFile = new File(webinfRealPath);
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\" valign=\"top\">"+"new File(getServletContext().getRealPath(\"/WEB-INF/\"))"+":&nbsp;</th>");
pout.write("<td>exists()="+ webInfRealPathFile.exists()
+ "; isFile()="+webInfRealPathFile.isFile()
+ "; isDirectory()="+webInfRealPathFile.isDirectory()
+ "; isAbsolute()=" + webInfRealPathFile.isAbsolute()
+ "; canRead()=" + webInfRealPathFile.canRead()
+ "; canWrite()=" + webInfRealPathFile.canWrite()
+"</td>");
if (webInfRealPathFile.exists() && webInfRealPathFile.isDirectory())
{
File webxml = new File(webInfRealPathFile, "web.xml");
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\" valign=\"top\">"+"new File(getServletContext().getRealPath(\"/WEB-INF/web.xml\"))"+":&nbsp;</th>");
pout.write("<td>exists()="+ webxml.exists()
+ "; isFile()="+webxml.isFile()
+ "; isDirectory()="+webxml.isDirectory()
+ "; isAbsolute()=" + webxml.isAbsolute()
+ "; canRead()=" + webxml.canRead()
+ "; canWrite()=" + webxml.canWrite()
+"</td>");
}
}
catch (Throwable t)
{
pout.write("<th align=\"right\" valign=\"top\">"+"Error probing the java.io.File(getServletContext().getRealPath(\"/WEB-INF/\"))"+":&nbsp;</th>");
pout.write("<td>"+ t + "</td>");
}
}
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\" valign=\"top\">"+"getServletContext().getServerInfo()"+":&nbsp;</th>");
pout.write("<td>"+ getServletContext().getServerInfo() + "</td>");
pout.write("</tr><tr>\n");
pout.write("<th align=\"right\" valign=\"top\">"+"getServletContext().getServletContextName()"+":&nbsp;</th>");
pout.write("<td>"+ getServletContext().getServletContextName() + "</td>");
pout.write("</tr><tr>\n");
pout.write("<th align=\"left\" colspan=\"2\"><big><br/>Context InitParameters:</big></th>");
a= getServletContext().getInitParameterNames();