If I have a relative path to a static asset (flash/blah.swf), what is the best way to programmatically convert this to an absolute URL (http://localhost/app/flash/blah.swf)? Or what is the best way to get the base URL of the Wicket application? I've tried using RequestUtils.toAbsolutePath but it doesn't seem to work reliably and is frequently throwing exceptions. This needs to work on all servers the app is deployed to.
For Wicket 6 it is
String absoluteUrl = RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse("my-relative-url.html"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With