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

Matteo Sotil edited comment on WICKET-4030 at 9/7/11 7:08 AM:
--------------------------------------------------------------

In fact, response.renderCSSReference("css/main.css")  was the first thing I 
tried, but it did'nt work.

Now I see that the real condition to reproduce the issue is using a wicket 
filter url pattern different than /*. I've updated issue summary, description 
and quickstart to reflect it. In quickstart, I changed wicket filter mapping 
like this:

        <filter-mapping>
                <filter-name>wicket.myproject</filter-name>
                <url-pattern>/wicket/*</url-pattern>
        </filter-mapping>

Now context path is /*, HomePage is not mounted, so application url is 
http://localhost:8080/wicket.
Now I use response.renderCSSReference("css/main.css") as should be. 

You will see that generated href is css/main.css, wich points to 
http://localhost:8080/wicket/css/main.css, when it should be ../css/main.css to 
point to http://localhost:8080/css/main.css, because css path passed to 
renderCSSReference should be _context-relative_ path, and not 
wicket-filter-url-pattern relative, isn't it?.

      was (Author: msotil):
    In fact, response.renderCSSReference("css/main.css")  was the first thing I 
tried, but it did'nt work.

Now I see I've simplified too much the quickstart; the issue is produced when 
wicket filter is different than /*, too. I've updated issue summary and 
description to reflect it. In quickstart, try changing wicket filter mapping 
like this:

        <filter-mapping>
                <filter-name>wicket.myproject</filter-name>
                <url-pattern>/wicket/*</url-pattern>
        </filter-mapping>

Then use response.renderCSSReference("css/main.css") as you said. You will see 
that generated href is ../css/main.css, wich points to 
http://localhost:8080/contextPath/wicket/css/main.css, when it should be 
../../css/main.css to point to http://localhost:8080/contextPath/css/main.css, 
because css path passed to renderCSSReference should be _context-relative_ 
path, and not wicket-filter-url-pattern relative, isn't it?.
  
> HeaderResponse.renderCSSReference does not render correct css link with 
> relative url in an application with wicket filter url-pattern different than 
> /*
> -------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4030
>                 URL: https://issues.apache.org/jira/browse/WICKET-4030
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-RC7
>            Reporter: Matteo Sotil
>            Assignee: Peter Ertl
>            Priority: Minor
>         Attachments: quickstart.zip
>
>
> In an application with a wicket filter url-pattern different than /*, if you 
> use HeaderResponse.renderCSSReference(String url), where url is a 
> context-path-relative url (css/main.css, for example), the generated css link 
> is not context relative, but wicket url-pattern relative.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to