Indent.
This commit is contained in:
parent
2c08119da5
commit
59e389c995
1 changed files with 14 additions and 3 deletions
|
@ -119,20 +119,31 @@ public class SimpleServletDispatcher extends HttpServlet
|
||||||
// String path = request.getRequestURI();
|
// String path = request.getRequestURI();
|
||||||
String path = request.getPathInfo();
|
String path = request.getPathInfo();
|
||||||
|
|
||||||
if ((!path.endsWith("/")) && (!path.endsWith(".xhtml")) && (!path.contains("-/")))
|
if (path == null)
|
||||||
|
{
|
||||||
|
response.setContentType("text/html");
|
||||||
|
PrintWriter out = response.getWriter();
|
||||||
|
|
||||||
|
out.println("<html><head></head><body>");
|
||||||
|
out.println("Unknow path.");
|
||||||
|
out.println("</body></html>");
|
||||||
|
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
else if ((!path.endsWith("/")) && (!path.endsWith(".xhtml")) && (!path.contains("-/")))
|
||||||
{
|
{
|
||||||
// path = getServletContext().getRealPath("/") +
|
// path = getServletContext().getRealPath("/") +
|
||||||
// request.getRequestURI();
|
// request.getRequestURI();
|
||||||
// First, search file in the WebContent root.
|
// First, search file in the WebContent root.
|
||||||
path = getServletContext().getRealPath("/") + request.getPathInfo();
|
path = getServletContext().getRealPath("/") + request.getPathInfo();
|
||||||
logger.info("path1=" + path);
|
logger.debug("path1=" + path);
|
||||||
if (!new File(path).exists())
|
if (!new File(path).exists())
|
||||||
{
|
{
|
||||||
// If file is not in WebContent root, search it in packaged
|
// If file is not in WebContent root, search it in packaged
|
||||||
// classes.
|
// classes.
|
||||||
path = getServletContext().getRealPath("/") + "WEB-INF/classes/" + this.webclassesRootPath.replaceAll("\\.", "/") + request.getPathInfo();
|
path = getServletContext().getRealPath("/") + "WEB-INF/classes/" + this.webclassesRootPath.replaceAll("\\.", "/") + request.getPathInfo();
|
||||||
}
|
}
|
||||||
logger.info("path2=" + path);
|
logger.debug("path2=" + path);
|
||||||
|
|
||||||
returnInlineFile(response, new File(path), getServletContext().getMimeType(path));
|
returnInlineFile(response, new File(path), getServletContext().getMimeType(path));
|
||||||
logger.info("File returned directly [" + path + "] with mimetype [" + getServletContext().getMimeType(path) + "].");
|
logger.info("File returned directly [" + path + "] with mimetype [" + getServletContext().getMimeType(path) + "].");
|
||||||
|
|
Loading…
Reference in a new issue