Redirecting from servlet to GWT place?

555 views Asked by At

There's a GWT application that uses GWT Places/Activities facility. There's also a servlet (currently, not related with GWT by all means) that I need to be able to redirect users to GWT app. Is there a way I can build a Place description in my servlet and then convert it to URL to redirect user to?

1

There are 1 answers

2
Thomas Broyer On BEST ANSWER

If the GWT app uses generated PlaceHistoryMapper implementation, then you can build an instance of the place on the server-side and pass it to its PlaceTokenizer's getToken method to get the place-specific token, and append to the tokenizer's prefix, with a colon (:) as a separator.

Otherwise, use the app's place history handler implementation (provided it can be used on the server) and call getToken.

Once you have the history token, then if the app uses the DefaultHistorian, then simply use the token as the hash of the URL. Otherwise, it'll depend on the app's own historian implementation (for instance, if uses the HTML5 History API, then it probably won't use a # in the URL).