Search code examples
gwtdeploymentgwt-hosted-mode

Check whether application running in hosted mode/deployment mode(local or remote machine)


I want to check whether my gwt application is running in hosted mode or deployment mode.and if deployed then check whether it is deployed on local machine or remote machine. Is there any way to do that.Because i want to change the urls depends on the mode.

Thanks,


Solution

  • I assume that by deployment you mean production mode.
    To check if you application runs in production mode call:

    com.google.gwt.core.client.GWT.isProdMode()
    

    it returns true when running in browser

    To check if your application runs in either hosted mode or production mode call:

    com.google.gwt.core.client.GWT.isClient()
    

    and use

    com.google.gwt.core.client.GWT.getHostPageBaseURL()
    

    to get url prefix of hosting page.