简体   繁体   English

跟踪dispatcher.forward的路径

[英]Tracing the path of a dispatcher.forward

I'm editing code that is not my own, and need to follow the path of a RequestDispatcher. 我正在编辑不属于我自己的代码,需要遵循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. 注释行dispatcher.forward(请求,响应)并添加此行,然后尝试运行servlet。

out.print(this.getServlet().getServletContext().getRealPath([url])); 的out.print(this.getServlet()的getServletContext()getRealPath([URL]));

This shall return the path to which the dispatcher will get forwarded to. 这将返回调度程序将转发到的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM