geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ciAnd7 <cind...@gmail.com>
Subject Request.getContextPath() after RequestDispatcher.forward()
Date Fri, 29 Feb 2008 13:29:57 GMT

Hi!

I have a problem with  servlet container (tomcat) in geronimo. May be it is
not right mailing list for such question, so please point me right place.

I am using geronimo/tomcat 2.0.2. But the same problems appears in G2.1 too. 

My web-application should work under root server context. So, there is 
<context-root>/</context-root> in geronimo-web.xml (as suggested by welcome
screen of   "welcome-tomcat" app).

It works fine. But there is one problem - JSTL tag <c:url..> produce double
leading slashs. I.e.
<c:url value="/img/pict.gif"/> out put "//img/pict.gif" (without  quotes).
Most browsers don`t understand such urls correctly.  

Investigating problem I found that first redundant slash appeared as result
of request.getContextPath(). This method used by implementation of JSTL OUT
tag to generate leading part of url  (see
/org/apache/taglibs/standard/tag/common/core/UrlSupport.java). 
According to specification, method request.getContextPath() should returns
empty string for root context path (and such behavior is expected by
UrlSupport.java). Instead, it returns "/" if called in forwarded
servlet/jsp. 

For example, Servlet mapped to "/servlet" and calls 
RequestDispatcher.forward() to jsp page. After that in forwarded jsp page
c:url tag will generate double leading slashes. If Servlet use
RequestDispatcher.include() instead of forward(), than c:url tag generates
right urls.

I could provide simple application to demonstrate problem.

Any ideas?

Thanks.

-- 
View this message in context: http://www.nabble.com/Request.getContextPath%28%29-after-RequestDispatcher.forward%28%29-tp15758360s134p15758360.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message