I am pretty sure, it is a bug. The reason why the urlFor(ResourceReference)
is not working properly is because you are using
BookmarkablePageRequestTargetUrlCodingStrategy for page mounting or a
similar strategy which encodes the params like this:
http://server/context/param1/value1/param2/value2 ... To prove that this is
a bug, try to change (just for test purpose) the mounting to
QueryStringUrlCodingStrategy, to make the url look like this: 
http://server/context?param1=value1. I suspect that when the url is built,
it depends on the page url from where the urlFor(ResourceReference) is
called... and wicket doesn't remove the parameters from the url and mess
this up... The real problem is when you are trying to build an absolute url
for a ResourceReference. If this is indeed the reason of the problem, we
should raise a jira issue... 

Alex Objelean  


pieter claassen-2 wrote:
> 
> Ok, but I have a panel and I want to add an Image to the panel but when I
> log into my application I get the ../../.. prefix, and the
> ResourceReference
> then fails. However, once I click on any link, the prefix disappears and
> then my panel can find the ResourceReference. Am I misunderstanding how
> resource references should be used?
> 
> Thanks,
> Pieter
> 
> On Tue, Oct 27, 2009 at 4:21 PM, Ryan McKinley <ryan...@gmail.com> wrote:
> 
>> urlFor( ) uses the current request to get a relative path.  If the
>> location
>> you are calling urlFor() from changes, it will get a new location....
>>
>> Note the only difference between the two urls is the ../../.. prefix
>>
>>
>> On Oct 27, 2009, at 11:05 AM, pieter claassen wrote:
>>
>>  WHen I start my application, my urlFor() returns a different URL than
>> when
>>> I
>>> call it a second time?
>>>
>>>       ResourceReference iconref = new ResourceReference(anchorclass,
>>> iconname);
>>>       System.out.println("URL: "+urlFor(iconref));
>>>
>>> First time it returns:
>>> URL:
>>>
>>> ../../../resources/com.musmato.wicket.pages.styles.option1.Option1StyleAnchor/document.png
>>>
>>> second time:
>>> URL:
>>>
>>> resources/com.musmato.wicket.pages.styles.option1.Option1StyleAnchor/document.png
>>>
>>> Any ideas?
>>>
>>> Thanks
>>> Pieter
>>> --
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> 
> -- 
> Pieter Claassen
> musmato.com
> 
> 

-- 
View this message in context: 
http://www.nabble.com/urlFor%28ResourceReference%29-strangeness-tp26079363p26089957.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to