I'm editing code that is not my own, and need to follow the path of a RequestDispatcher.
RequestDispatcher dispatcher = this.getServlet().getServletContext().getRequestDispatcher([url]);
if (dispatcher == null) {
throw new Exception("Unable to find " + [url]);
}
logger.debug("Dispatching request to PDF Writer Servlet " + dispatcher.toString());
dispatcher.forward(request, response);
How can I find out where the path will take me?
Comment the line dispatcher.forward(request, response) and add this line and then try running the servlet.
out.print(this.getServlet().getServletContext().getRealPath([url]));
This shall return the path to which the dispatcher will get forwarded to.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.