Sven Schliesing <schliesing <at> subshell.com> writes:

> The Application is started and looks if it has a property file 
> "configFileLocation.properties" (this just contains the name of the real 
> configuration file) in it's webroot.
> - If it is not found all future requests get redirected to a wizard-page 
> where the user can configure the location of the _real_ configuration 
> file. After this configuration step the file 
> "configFileLocation.properties" is created.

Try:

public class ConfigurableApp extends WebApplication {
  private boolean configured;

  protected void init() {
    lookForConfigFile();
    getSecuritySettings().setAuthorizationStrategy(
        new AbstractPageAuthorizationStrategy() {
          protected boolean isPageAuthorized(Class pageClass) {
            return configured
                || pageClass == ConfigWizardPage.class;
          }
        });
    getSecuritySettings().setUnauthorizedComponentInstantiationListener(
        new IUnauthorizedComponentInstantiationListener() {
          public void onUnauthorizedInstantiation(Component component) {
            throw new RestartResponseAtInterceptPageException(
                ConfigWizardPage.class);
          }
        });
  }

  public void lookForConfigFile() {
    ...
    configured = ...;
  }
}


public class ConfigWizardPage extends WebPage {
  public ConfigWizardPage() {
    add(new Link("done") {
      public void onClick() {
        ((ConfigurableApp) getApplication()).lookForConfigFile();
        setResponsePage(Home.class);
      }
    });
  }
}


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to