javagwtgwt-activitiesgwt-places

How to generate a navigable URL for a particular slotted place?


How do I generate the URL to navigate to a particular place in slotted? I know that to navigate the current user to a particular place, it would just be (assuming slottedController is defined and pointing to a valid SlottedController instance):

slottedController.goTo(new MyDesiredPlace(param1, param2));

However, my use case is to generate a URL to be inserted into an e-mail, and when the recipient receives the e-mail, they'll click the URL and should be navigated to the specified place. How would I generate such a URL in slotted?


Solution

  • SlottedController has two method for helping create Urls: createToken() and createUrl(). The createToken() will create a history token that appears after the #, which can be used with GWT Hyperlink. The createUrl() is the same as the token method, but prepends the current URI, which can be used with Anchor or external links like an email.

    As a note, SlottedController can only be run on the client, so there is currently no way to create the URL on the Server side. The URL must be created on the client and passed back to the server.