You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anirban Basak <an...@rebaca.com> on 2008/11/11 12:51:45 UTC
wicket prepends unnecessary ../ before href/src html element attributes
(replacing proprietary names/texts with xx)
I’m running wicket web app with context ‘xx’.
As long I’m mounting pages with mountBookmarkablePage(..) or other URL
encoding strategies (http://www.test-server.com/xx/web/page/partner) or
mentioning /xx/* as the filter pattern, everything is running fine. But I
was told not to append any word after the context
(http://www.test-server.com/xx/). I tried removing URL encoding strategies,
but wicket returning wrong relative urls by prepending unnecessary ‘../’ to
the resource uris like:
<link href="xxweb/css/styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="xxweb/css/dhtmlwindow.css" type="text/css" />
<script type="text/javascript" src="xxweb/js/dhtmlwindow.js"></script>
<script type="text/javascript" src="xxweb/js/partnerpages.js"></script>
Wicket converting them into:
<link href="../xxweb/css/styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../xxweb/css/dhtmlwindow.css" type="text/css"
/>
<script type="text/javascript" src="../xxweb/js/dhtmlwindow.js"></script>
<script type="text/javascript" src="../xxweb/js/partnerpages.js"></script>
This makes the browser unable to fetch the resources as
“../xxweb/css/styles.css” ==
“http://www.test-server.com/xxweb/css/styles.css”
Structure of the WAR
xx-snapshot.war
|-- index.html (incase wicket not running)
|-- xx-config.xml
|-- WEB-INF
|-- web.xml
|-- lib
|-- classes
|-- xxweb
|-- css
|-- images
|-- js
Web.xml
<filter>
<filter-name>wicket.xx</filter-name>
<filter-class>
org.apache.wicket.protocol.http.WicketFilter
</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>com.xx.xx.xxWebApplication</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>wicket.xx</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
Is this because of any wicket specific restriction or something else?
Anirban