In my ApplicationBootstrapper implements Bootstrapper
I have access to the injected PlaceManager
:
public class ApplicationBootstrapper implements Bootstrapper {
private PlaceManager placeManager;
@Inject
public ApplicationBootstrapper(PlaceManager placeManager) {
this.placeManager = placeManager;
}
}
However, if I try to reveal the place that is set in the place manager like this:
private void revealRequestedPlaceAfterBootstrapping() {
PlaceRequest currentPlaceRequest = this.placeManager.getCurrentPlaceRequest();
this.placeManager.revealPlace(currentPlaceRequest );
}
it's not working. The reason appears to be that the currentPlaceRequest
does not contain any information about the current URL that's being accessed leaving me with an empty web page.
What am I doin wrong? How can I reveal the requested place as my application is starting up?
I'm no expert but I believe you are trying to get a PlaceRequest
before one exists. Try just calling:
placeManager.revealCurrentPlace()
- this will reveal the page the user has tried to access (most likely your homepage if there is nothing after the # in the url).
OR
placeManager.revealDefaultPlace()
- this will reveal whatever you set to your default place in your ClientModule
.
See Revealing Places and Initialize GIN for more information.
Good luck and have fun!