tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: TC 9.0.21: ContextListener + Servlet app
Date Thu, 20 Jun 2019 10:58:24 GMT
On June 20, 2019 10:00:12 AM UTC, Tommy Pham <tommyhp2@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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message