Just a quick Wicket tid-bit I found today - generally with Wicket, when you create a BookmarkablePageLink or use "urlFor(...)", the resulting URL is stated as a relative path, e.g. "../../something/mypage" (i.e. those that contain "..").
Sometimes you need to get a "fully qualified" URL such as "/pages/something/mypage" or "http://localhost:8080/myapp/pages/something/mypage".
Although there is nothing on the core Wicket objects to do this, there is a little utility included with Wicket which will allow you to convert a relative URL to an absolute URL - org.apache.wicket.protocol.http.RequestUtils
It's dead simple to use - just call RequestUtils.toAbsolutePath(...) and pass in the relative URL as a string. Assuming the relative URL was generated from the current Wicket Page, it will convert from "../../something/mypage" to "http://localhost:8080/myapp/pages/something/mypage"
Richard Nichols is an Australian software engineer with a passion for good design and simple solutions.
You could follow him on twitter or subscribe by RSS or email.