Chapter 5. Configuration

5.1. Servlet Configuration
5.1.1. Servlet Mapping
5.1.2. Load On Startup
5.1.3. Type Converter Class
5.1.4. Config Service Class
5.2. Application Configuration
5.2.1. Click App
5.2.2. Pages Multiple Pages Packages
5.2.3. Page Page Automapping Automapping Excludes Page Autobinding Page Autobinding - Using Annotations
5.2.4. Headers Browser Caching
5.2.5. Format
5.2.6. Mode Page Auto Loading Click and Velocity Logging
5.2.7. Controls
5.3. Auto Deployed Files
5.3.1. Deploying resources in a restricted environment
5.3.2. Deploying Custom Resources

This section discusses how to setup and configure an Apache Click web application.

The Click configuration files include:

  • WEB-INF/ click.xml   -   Application Configuration ( required)

  • WEB-INF/ web.xml   -   Servlet Configuration ( required)

5.1. Servlet Configuration

For a Click web application to function the ClickServlet must be configured in the web application's /WEB-INF/web.xml file. A basic web application which maps all *.htm requests to a ClickServlet is provided below.





5.1.1. Servlet Mapping

By convention all Click page templates should have an .htm extension, and the ClickServlet should be mapped to process all *.htm URL requests. With this convention you have all the static HTML pages use an .html extension and they will not be processed as Click pages.

5.1.2. Load On Startup

Note you should always set load-on-startup element to be 0 so the servlet is initialized when the server is started. This will prevent any delay for the first client which uses the application.

The ClickServlet performs as much work as possible at startup to improve performance later on. The Click start up and caching strategy is configured with the Click application mode element in the "click.xml" config file, covered next.

5.1.3. Type Converter Class

The ClickServlet uses the OGNL library for type coercion when binding request parameters to bindable variables. The default type converter class used is RequestTypeConverter. To specify your own type converter configure a type-converter-class init parameter with the ClickServlet. For example:


5.1.4. Config Service Class

Click uses a single application configuration service which is instantiated by the ClickServlet at startup. This service defines the application configuration and is used by the ClickServlet to map requests to pages amongst other things.

Once the ConfigService has been initialized it is stored in the ServletContext using the key ConfigService The default ConfigService is XmlConfigService, which configuration is discussed in detail in the next section.

To use an alternative configuration service specify a config-service-class context parameter. For example:

<web-app xmlns=""