Hi Mark,

On Thu, Jun 20, 2019 at 3:58 AM Mark Thomas <ma...@apache.org> wrote:

> On June 20, 2019 10:00:12 AM UTC, Tommy Pham <tommy...@gmail.com> wrote:
>
> <snip/>
>
> >> In looking at the code for ApplicationHttpRequest [1] for the
> >> getPathTranlated()
> >>
> >>     @Override
> >>     public String getPathTranslated() {
> >>         if (getPathInfo() == null || getServletContext() == null) {
> >>             return null;
> >>         }
> >>         return getServletContext().getRealPath(getPathInfo());
> >>     }
> >>
> >> and for the getRequestDispatcher()
> >>
> >>         if (pathInfo == null) {
> >>             requestPath = servletPath;
> >>         } else {
> >>             requestPath = servletPath + pathInfo;
> >>                   }
> >>
> >> Perhaps the getPathTranslated() could be ?
> >>
> >> if ( getServletContext() != null) {
> >>     if (getServletPath() != null) {
> >>        if (getPathInfo() != null) {
> >>
> >>            return getServletContext().getRealPath(getServletPath() +
> >> getPathInfo());
> >>        }
> >>        return getServletContext().getRealPath(getServletPath());
> >>     }
> >> }
> >> return null;
> >>
> >> I think that would also fix the translated path I saw earlier which
> >> resulted in a blank page for the browser.
>
> Sorry, no. The Servlet spec defines the behaviour of those methods and
> Tomcat correctly implements the requirements of the Servlet spec.
>
> Mark
>
>
Based on my understanding, the getPathTranslated allows the TC's default
servlet to find the file located on the file system to fulfill the
request.  Since it's incorrect, how can I get the TC's default servlet to
work correctly?  Please clarify if I misunderstood getPathTranslated's
purpose or how TC's default servlet would find the file in question to
fulfill the request.

 Thank you,
Tommy

Reply via email to