You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Juergen Donnerstag (JIRA)" <ji...@apache.org> on 2010/02/07 10:32:27 UTC

[jira] Commented: (WICKET-2723) ContextImage url incorrect when tomcat 6 welcomefile (index.jsp) is present and url is context homepage

    [ https://issues.apache.org/jira/browse/WICKET-2723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12830686#action_12830686 ] 

Juergen Donnerstag commented on WICKET-2723:
--------------------------------------------

I know it doesn't solve your problem, but may be a redirect in general is a better solution rather than telling the user he/she is wrong and needs to use another url


<html>
<head>
	<meta http-equiv="Refresh" content="0; url="here goes your homepage url">
</head>
</html>


> 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.