anchor.diff:  @edu.umd.cs.findbugs.annotations.SuppressFBWarnings( { "STT_STRING_PARSING_A_FIELD", "PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS", "PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS", "ACEM_ABSTRACT_CLASS_EMPTY_METHODS" } )
   public abstract class <%= repository.gwt.abstract_application_name %><I extends <%= repository.gwt.qualified_abstract_sting_injector_name %>>
   {
  -<% if repository.keycloak? -%>
  +<% if repository.keycloak? || repository.imit? -%>
  +  @javax.annotation.Nonnull
  +  private final String _applicationURL;
  +<% end -%>
  +<% if repository.keycloak? -%>
  +  @javax.annotation.Nonnull
     private final org.realityforge.gwt.keycloak.Keycloak _keycloak;
   <% end -%>
   
     protected <%= repository.gwt.abstract_application_name %>(<% if repository.keycloak? -%> @javax.annotation.Nonnull final String keycloakClient <% end -%>)
     {
  -<% if repository.keycloak? -%>
  -    _keycloak = new org.realityforge.gwt.keycloak.Keycloak( keycloakClient, com.google.gwt.core.client.GWT.getHostPageBaseURL() + ".keycloak/" + keycloakClient + "/keycloak.json" );
  +    _applicationURL = calculateApplicationURL();
  +<% if repository.keycloak? -%>
  +    _keycloak = new org.realityforge.gwt.keycloak.Keycloak( keycloakClient, _applicationURL + ".keycloak/" + keycloakClient + "/keycloak.json" );
  +    org.realityforge.gwt.keycloak.cache.TokenCache.configure( _keycloak );
       _keycloak.addKeycloakListener( new org.realityforge.gwt.keycloak.cache.TokenCachingListener() );
       _keycloak.addKeycloakListener( newKeycloakListener() );
   <% end -%>
  +  }
  +
  +  @javax.annotation.Nonnull
  +  protected final String getApplicationURL()
  +  {
  +    return _applicationURL;
  +  }
  +
  +  @javax.annotation.Nonnull
  +  protected String calculateApplicationURL()
  +  {
  +    if ( isSuperDevMode() )
  +    {
  +      // As the code is generated by codeserver we just guess that the application url is where the host page is
  +      return com.google.gwt.core.client.GWT.getHostPageBaseURL();
  +    }
  +    else
  +    {
  +      // Assume that the root of the application is the parent directory where the module is stored
  +      return com.google.gwt.core.client.GWT.getModuleBaseURL().substring( 0, com.google.gwt.core.client.GWT.getModuleBaseURL().length() - com.google.gwt.core.client.GWT.getModuleName().length() - 1 );
  +    }
     }
   
     @javax.annotation.Nullable
  
positive.code:     initializeArez();
  <% end -%>
  <% if repository.imit? -%>
      registerReplicantConnector( com.google.gwt.core.client.GWT.getHostPageBaseURL() + "api", ensureInjector().getSystemSchema() );
  <% end -%>
    }
  
  
negative.code: 
    private void setupServiceWorker()
    {
      if ( null != elemental2.dom.DomGlobal.navigator.serviceWorker && !isSuperDevMode() )
      {
        elemental2.dom.DomGlobal.navigator.serviceWorker
          .register( com.google.gwt.core.client.GWT.getModuleBaseForStaticFiles() + com.google.gwt.core.client.GWT.getModuleName() + "-sw.js" )
  