Author(s)Jonathan Locke, Chris Turner, Johan Compagner, Eelco Hillenius, Juergen Donnerstag
A web application is a subclass of Application which associates with an
instance of WicketServlet to serve pages over the HTTP protocol. This class
is intended to be subclassed by framework clients to define a web
application.
Application settings are given defaults by the WebApplication() constructor
and internalInit method, such as error page classes appropriate for HTML.
WebApplication subclasses can override these values and/or modify other
application settings by overriding the init() method and then by calling
getXXXSettings() to retrieve an interface to a mutable Settings object. Do
not do this in the constructor itself because the defaults will then override
your settings.
If you want to use servlet specific configuration, e.g. using init parameters
from the ServletConfig object, you should override the
init() method. For example:
Application settings are given defaults by the WebApplication() constructor and internalInit method, such as error page classes appropriate for HTML. WebApplication subclasses can override these values and/or modify other application settings by overriding the init() method and then by calling getXXXSettings() to retrieve an interface to a mutable Settings object. Do not do this in the constructor itself because the defaults will then override your settings.
If you want to use servlet specific configuration, e.g. using init parameters from the ServletConfig object, you should override the init() method. For example:
public void init() { String webXMLParameter = getWicketServlet().getInitParameter("myWebXMLParameter"); URL schedulersConfig = getWicketServlet().getServletContext().getResource("/WEB-INF/schedulers.xml"); ...