-
Notifications
You must be signed in to change notification settings - Fork 10
Extending from BaseWebApplication
How should look a base wicket application class?
If you write a base wicket application class you have to consider the initialization process. There you do your application settings. There are different settings for the appropriate mode. There are two modes to consider. The development and the deployment mode. What you also have to consider is the global configuration that shell exist on both modes.
I think the best way to do this is with callback methods. The best place to do that is in the init method of the base wicket application class and declare the init method as final so the subclasses shell use only the callback methods.
BaseWebApplication does exactly that. It has a callback method onApplicationConfigurations that have an algorithm for the initialization process. In that method are called other callback methods where the first call is the onBeforeApplicationConfigurations method. Overwrite this callback method to set all configuration that have to be set before all other application configurations.
The next callback method that is called right after onBeforeApplicationConfigurations is onGlobalSettings. Overwrite this callback method to set all configuration that should be set in both modes.
The next callback method that is called right after onGlobalSettings depends on in which mode the application runs.
If the application is running on development mode the callback method onDevelopmentModeSettings is called. Overwrite this callback method to set configuration for the development.
If the application is running on deployment mode the callback method onDeploymentModeSettings is called. Overwrite this callback method to set configuration for the deployment.