質問

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top