Author(s)Jonathan Locke, Timur Mehrvarz, Juergen Donnerstag, Igor Vaynberg (ivaynberg)
Servlet class for all wicket applications. The specific application class to
instantiate should be specified to the application server via an init-params
argument named "applicationClassName" in the servlet declaration, which is
typically in a web.xml file. The servlet declaration may vary from
one application server to another, but should look something like this:
Note that the applicationClassName parameter you specify must be the fully
qualified name of a class that extends WebApplication. If your class cannot
be found, does not extend WebApplication or cannot be instantiated, a runtime
exception of type WicketRuntimeException will be thrown.
As an alternative, you can configure an application factory instead. This
looks like:
When GET/POST requests are made via HTTP, an WebRequestCycle object is
created from the request, response and session objects (after wrapping them
in the appropriate wicket wrappers). The RequestCycle's render() method is
then called to produce a response to the HTTP request.
If you want to use servlet specific configuration, e.g. using init parameters
from the ServletConfig object, you should override the
init() method of GenericServlet . For example:
In order to support frameworks like Spring, the class is non-final and the
variable webApplication is protected instead of private. Thus subclasses may
provide there own means of providing the application object.
<servlet> <servlet-name>MyApplication</servlet-name> <servlet-class>wicket.protocol.http.WicketServlet</servlet-class> <init-param> <param-name>applicationClassName</param-name> <param-value>com.whoever.MyApplication</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>Note that the applicationClassName parameter you specify must be the fully qualified name of a class that extends WebApplication. If your class cannot be found, does not extend WebApplication or cannot be instantiated, a runtime exception of type WicketRuntimeException will be thrown. As an alternative, you can configure an application factory instead. This looks like:<init-param> <param-name>applicationFactoryClassName</param-name> <param-value>teachscape.platform.web.wicket.SpringApplicationFactory</param-value> </init-param>and it has to satisfy interface IWebApplicationFactory .When GET/POST requests are made via HTTP, an WebRequestCycle object is created from the request, response and session objects (after wrapping them in the appropriate wicket wrappers). The RequestCycle's render() method is then called to produce a response to the HTTP request.
If you want to use servlet specific configuration, e.g. using init parameters from the ServletConfig object, you should override the init() method of GenericServlet . For example:
public void init() throws ServletException { ServletConfig config = getServletConfig(); String webXMLParameter = config.getInitParameter("myWebXMLParameter"); ...In order to support frameworks like Spring, the class is non-final and the variable webApplication is protected instead of private. Thus subclasses may provide there own means of providing the application object.