here is my understanding of the usecase ( eelco feel free to jump in and tell me im smoking something at any point )

lets say we have a wicket app that lives in http://localhost/wicketapp/ and the servlet is mounted as /app/*   I also have a page called Test and inside the markup it has a link to an image like so <img src="">
when i hit the page its url is http://localhost/wicketapp/app?bookmarkablePage=Test
so the browser sees this request originate for document: http://localhost/wicketapp/app when it is going to resolve the path of the image it will first check if it starts with /, it it does the exact path will be used, if it doesnt the path will be relative to the parent document's path.

since the document is http://localhost/wicketapp/app its path is http://localhost/wicketapp/ so the image path will be resolved to http://localhost/wicketapp/images/dot.gif

this is great because no matter what page i access the browser will always resolve its path to the root of my context. this allows me to have an images dir and a css dir and it is always safe to link as src="" or href=""

path mounting introduces a problem because while the entry point remains the same, browser will not see it that way. lets say i mount Test on /pages/t/Test. The url becomes http://localhost/wicketapp/app/pages/t/Test. now when the browser will try to resolve the image it will be resolved to http://localhost/wicketapp/app/pages/t/images/dot.gif . this is the problem.

a key to fixing this would be to prepend all paths that do not start with a / with the context path.
so <img src="" would become <img src="" this will guarantee that no matter where the page lives the browser will always resolve relative to the root context (because the path starts with a / )

-Igor


On 12/3/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
On 12/3/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> Hi Juergen,
> just checked out your cvs changes for url prefixing. wouldnt it make more
> sense to prefix urls that /do not/ start with a slash. after all, those are
> the ones that would be broken if url mounting is used. i think all urls that
> start with a slash should be left alone because those are the ones that are
> referencing something off the server root context. all urls without the
> slash (relative to the app context) should be prefixed.
>

I must admit I don't understand the whole use case already. And I
don't understand the mounted paths yet.
How do know that the relativ path is relative the context? wicket:link
creates links relative to the page (on the class path). Is that no
longer needed/possible?


> also is it really safe to modify every attribute? i would limit this to href
> and src attrs only i think.
>

That is a good question. I had a short discussion with Eelco after he
asked how difficult it would be to implement it. We shortly discussed
using wicket:link, but the whole discussion I guess has only started
yet. The current implementation is not meant to be final at all.

Juergen


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to