Reputation: 2509
I want to create a restful link for each user, who registered on my page. For Example: User "testuser" registered on my page and his profile should be accessible through www.mypage.com/users/testuser.
How can i realize something in wicket?
Upvotes: 0
Views: 850
Reputation: 3396
in WebApplication implementation add to init():
mountPage("/users/${id}", UserPage.class);
and in UserPage.class :
public UserPage(PageParameters parameters) {
String id = parameters.get("id").toString();
...
}
Upvotes: 3
Reputation: 7696
Have a look at mounting pages in wicket 1.5. It describes the methods to 'mount', aka make available, a page on a certain url. Parameters to that page (in your case, the user name) can either be via name or via index (position).
You will be interested in the positioning parameters.
Upvotes: 0
Reputation: 6685
Is it possible to introduce a additional url path element? Something like "http://server/users/userid/testuser"? If you have mount your page to the url "users" then the page will be initialized by wicket using the constructor with the PageParameters parameter:
public class UserPage extends WebPage {
public UserPage(PageParameters pars) {
String userId = pars.getParameterValue("userid");
...
}
}
Upvotes: 0