ContextImage url incorrect when tomcat 6 welcomefile (index.jsp) is present and
url is context homepage
-------------------------------------------------------------------------------------------------------
Key: WICKET-2723
URL: https://issues.apache.org/jira/browse/WICKET-2723
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.4.6
Environment: Tomcat 6.0.24, Wicket 1.4.6, Windows XP Pro, JDK 1.6.0_05
Reporter: Jamie Maher
Priority: Minor
Background:
Context running at: http://localhost:8080/test/
The example that I'm using included a index.jsp containing: Wicket does not use
JSP pages!
web.xml contains:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
Problem:
When adding a ContextImage to my HomePage, the generated URL is incorrect:
new ContextImage("footer-logo", "images/footer.jpg")
When requesting the root of the context:
http://localhost:8080/test/
The generated ContextImage src attribute becomes:
src="../images/footer.jpg"
Resulting in the URL:
http://localhost:8080/images/footer.jpg
Looking at the request state by stepping through the onComponentTag of
ContextPathGenerator, the WebRequestCodingStrategy method
rewriteStaticRelativeUrl(path) passes off to
UrlUtils.rewriteToContextRelative(string,request).
This then passes to the wicket ServletWebRequest to generate the prefix:
When a welcome file is present, the request's servletPath is set to
"/index.jsp" resulting in the wicketPath being equal to "/index.js" instead of
"" (blank) at line 225 of ServletWebRequest.
This incorrectly causes the prepender to add "../" to the prefix.
If the index.jsp file is deleted from the web root folder, or renamed to a
non-welcome file then the correct src url is generated.
The ServletWebRequest should check for this HomePage index special? case..
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.