Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial
Getting Started
Configuration
Topics
JSP
XTP/XSL
JavaScript
JS Library
Resin Config
HTTP Config
App Config
Servlet Config
Login Config
Taglib Config
Summary
Servlet Configuration
Servlet configuration follows the Servlet 2.2 deployment descriptors. Servlets generally belong in the WEB-INF/classes directory of the web application. The mapping from url to servlet is controlled by servlet mapping in the application configuration. For a complete, working example, see Servlet or experiment with the Hello, World demo.
web-app
servlet | Defines a servlet alias for later mapping.
web-app/servlet
servlet-name | Alias of the servlet
servlet-class | Class of the servlet
init-param | Initializes servlet variables.
load-on-startup | If present, starts the servlet when the server starts.
run-at | If present, executes the servlet's service() method at the specified times.
web-app
### servlet
Defines a servlet alias for later mapping.
servlet-name | The servlet's name (alias)
servlet-class | The servlet's class (defaults to servlet-name)
init-param | Initialization parameters
load-on-startup | Initializes the servlet when the server starts.
run-at | Times to execute the servlet automatically
The following example defines a servlet alias 'hello'
<web-app id='/'> <servlet-mapping url-pattern='/hello.html' servlet-name='hello'/> <servlet servlet-name='hello' servlet-class='test.HelloWorld'> <init-param title='Hello, World'/> </servlet> <servlet servlet-name='cron' servlet-class='test.DailyChores'> <run-at>3:00</run-at> </servlet> </web-app>
web-app/servlet
### servlet-name
Alias of the servlet
### servlet-class
Class of the servlet The CLASSPATH for servlets includes the WEB-INF/classes directory and all jars in the WEB-INF/lib directory.
### init-param
Initializes servlet variables. `servlet-param` defines initial values for `getServletConfig().getInitParameter("foo")`. The full servlet 2.2 syntax is supported and allows a simple shortcut
<web-app id='/'> <servlet servlet-name='test.HelloWorld'> <init-param foo='bar'/> <init-param> <param-name>baz</param-name> <param-value>value</param-value> </init-param> </servlet> </web-app>
### load-on-startup
If present, starts the servlet when the server starts.
<web-app id='/'> <servlet servlet-name='test.HelloWorld'> <load-on-startup/> </servlet> </web-app>
### run-at | ### Resin 1.1
If present, executes the servlet's service() method at the specified times. <run-at> lets servlet writers execute periodic tasks without worrying about creating a new Thread. The value is a list of 24-hour times when the servlet should be automatically executed. To run the servlet every 6 hours, you could use
<servlet servlet-name='test.HelloWorld'> <run-at>0:00, 6:00, 12:00, 18:00</run-at> </servlet>
If the hour is omitted, the servlet runs every hour at the specified minute. To run the server every 15 minutes, you could use:
<servlet servlet-name='test.HelloWorld'> <run-at>:00, :15, :30, :45</run-at> </servlet>
App Config |  | Login Config
Copyright © 1998-2000 Caucho Technology. All rights reserved. Last modified: Mon, 01 May 2000 08:49:33 -0700 (PDT)