Try this:

        url.getSegments().add("");
        url.getSegments().add("site2");
        url.getSegments().add("image");

Have a look at the code of Url#isAbsolute(). It checks if the first segment is empty which is not the case with the code you provided in the first email.

This behavior of the segments array is definitely not intuitive... Another solution would be this:

        url = Url.parse("http://localhost:8080/";);
        url.getSegments().add("site2");
        url.getSegments().add("image");
        url.setQueryParameter("param1", "1");
        url.setQueryParameter("param2", "2");

This creates the first empty segment automatically.

On 07/06/2013 10:43 AM, bronius wrote:
Yes that would be great, but src="app2/image?item-123" does not work (image
is not loaded) and after changing it with firebug to
src="http://localhost:8080/app2/image?item-123"; works fine. Any ideas why is
that? Any stupid mistake i overlooked? Maybe wicket interprets relative url
as http://localhost:8080/app1/app2/image?item-123 somehow? Maybe because
when i build url I put app2 as segment? (url.getSegments().add("app2");) I
will try different way to construct url later. Thanks for help appreciate it
:)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/UrlResourceReference-for-images-tp4659261p4659279.html
Sent from the Users forum 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



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

Reply via email to