Hello,

Im trying to serve images from other server, but need to build url for
images on server side. This looks very simple and on most frameworks very
easy to accomplish, but on wicket I simply do not understand what to do...
Im trying like this: 
final Image img = new Image(IMAGE_ID_ADIMG, new
UrlResourceReference(createUrl(null)));

First of all Url api is extremely hard to work with, very hard to create url
i need, I think there should be some option to simply create it with simple
string. Anyway Url.parse method does not create full url for me (i have
localhost:8080/site1 and localhost:8080/site2, but when url is created i get
only site2 without full address). So I tried it myself like this:
 private Url createUrl(Charset charset) {
        Url url = new Url(charset) {
            private static final long serialVersionUID = 1L;
            @Override
            public String toString(final Charset charset)
            {
                return toString(StringMode.FULL, charset);
            }
        };
        url.setProtocol("http");
        url.setHost("localhost");
        url.setPort(8080);
        url.getSegments().add("site2");
        url.getSegments().add("image");
        url.setQueryParameter("param1", "1");
        url.setQueryParameter("param2", "2");
        return url;
    }

Not really nice, but at least Url object returned normal full url that i
needed in toString. However UrlResourceReference still rendered not full url
and thats where i got too pissed off and decided I need some rest :) I'm
just interested if I'm even on the right track? How you would implement it?
And why this simple thing is so complicated? :) I admit I was a bit drunk :)
and don't have that much of experience with wicket, but this part looked
really strange for me. But I suspect I'm missing something. The problem is
probably because both applications have same start (http://localhost:8080)
and wicket is too smart. As image from other random website is shown
successfully.

Looking forward hearing from you :)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/UrlResourceReference-for-images-tp4659261.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

Reply via email to