View final URL in Servlet RequestDispatcher forward

Posted on 2007-07-23
Last Modified: 2013-11-24
Im using Java servlets and Im using the following code to perform a forward:

 RequestDispatcher rd = request.getRequestDispatcher(url);
            rd.forward(request, response);

My question is: How do I view the final url that the app is forwarding to? I want to see the url after any contexts or anything else has been pre-pended to it. I want to see where the app is actually being forwarded to.

For instance, if I pass in home.html as my url variable, how do I determine what the url variable will look like when RequestDispatcher gets finished with it?

Any help is greatly appreciated!!!

Ive been stuck on this for a while now....:(

Thank you,
Question by:texastemplar
    LVL 92

    Accepted Solution

    just log the value of the url variable

    Author Comment

    That wont work. Im trying to determine the exact url that the app is being forwarded to.

    Any other ideas?
    LVL 92

    Expert Comment

    why won't it work?

    Author Comment

    I figured it out. The app Im working with had a default error page setup in web.xml so I commented it out and ran the app. This allowed me to see Apache's error page instead of the applications error page. The default error page that Apache uses showed me the url that the RequestDispatcher.forward was creating.  
    LVL 92

    Expert Comment

    which would be the value of the 'url' variable wouldn't it?
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now