Web Application: tags
Resin 3.1

Documentation
Examples
Changes

Overview
Installation
Configuration
Quercus
SOA/IoC
JSP
Servlets and Filters
Admin (JMX)
EJB
Amber
Security
Performance
Hessian
XML and XSLT
Third-party
Troubleshooting/FAQ

tags
Common Tasks
Relax Schema
howto
Config FAQ
Scrapbook
DB Scrapbook

env tags
<resin>
<cluster>
<server>
port tags
<host>
<web-app>
<database>
session tags
rewrite tags
service tags
log
el variables
el control
<host>
tags
<database>

web application
A web application is a self-contained subtree of the web site. It has a distinct Application object (ServletContext), sessions, and servlet mappings.

Web applications are configured with the <web-app> tag, which can occur in a number of places.

  • WEB-INF/web.xml contains a top-level web-app element. It is the Servlet standard location for defining things like servlet mappings and security roles.
  • WEB-INF/resin-web.xml is also used by Resin and will override and supplement the configuration in WEB-INF/web.xml. Use it to specify Resin specific configuration if you prefer to keep WEB-INF/web.xml strictly conforming to the Servlet specification.
  • A web application can also be configured in the main Resin configuration, and in this context web-app is a child of <host>.
<access-log>
child of web-app

<access-log> configures a HTTP access log for an indivitual web-app. See access-log in the <host> tag for more information.

<active-wait-time>
child of web-app

<active-wait-time> sets a 503 busy timeout for requests trying to access a restarting web-app. If the timeout expires before the web-app complete initialization, the request will return a 503 Busy HTTP response.

<allow-servlet-el>
child of web-app

The <allow-servlet-el> flag configures whether <servlet> tags allow EL expressions in the init-param.

<archive-path>
child of web-app

<archive-path> configures the location of the web-app's .war file. In some configurations, the .war expansion might not use the webapps/ directory, but will still want automatic war expantion.

<auth-constraint>
child of security-constraint

Requires that authenticated users fill the specified role. In Resin's JdbcAuthenticator, normal users are in the "user" role. Think of a role as a group of users.

role-nameRoles which are allowed to access the resource.
<cache-mapping>
child of web-app

Specifies Expires times for cacheable pages.

cache-mapping is intended to provide Expires times for pages that have Last-Modified or ETags specified, but do not wish to hard-code the Expires timeout in the servlet. For example, Resin's FileServlet relies on cache-mapping to set the expires times for static pages.

url-patternA pattern matching the url:/foo/*, /foo, or *.foo
url-regexpA regular expression matching the url
expiresA time interval.

The time interval defaults to seconds, but will allow other periods:

SuffixMeaning
sseconds
mminutes
hhours
Ddays
  • cache-mapping requires an enabled <cache>. If the cache is disabled, cache-mapping will be ignored.
  • cache-mapping does not automatically make a page cacheable. Only cacheable pages are affected by cache-mapping, i.e. pages with an ETag or Last-Modified.
cache-mapping in resin-web.xml
<web-app xmlns="http://caucho.com/ns/resin">

  <cache-mapping url-pattern='/*'
                 expires='10'/>

  <cache-mapping url-pattern='*.gif'
                 expires='15m'/>

</web-app>
<constraint>
child of security-constraint

Defines a custom constraint.

resin:typeA class that extends AbstractContstraint
initinitialization parameters, set in the object using Bean-style setters and getters
<context-param>
child of web-app

Initializes application (ServletContext) variables. context-param defines initial values for application.getInitParameter("foo"). See also ServletContext.getInitParameter().

context-param in resin-web.xml
<web-app xmlns="http://caucho.com/ns/resin">

  <context-param>
    <param-name>baz</param-name>
    <param-value>value</param-value>
  </context-param>

  <!-- shortcut -->
  <context-param foo="bar"/>

</web-app>
<cookie-http-only>
child of web-app

The <cookie-http-only> flag configures the Http-Only attribute for all Cookies generated from the web-app. The Http-Only attribute can add security to a website by not forwarding HTTP cookies to SSL HTTPS requests.

<description>
<display-name>
<distributable>
<ear-deploy>
child of host, web-app

Specifies ear expansion.

ear-deploy can be used in web-apps to define a subdirectory for ear expansion.

pathThe path to the deploy directoryrequired
expand-pathdirectory where ears should be expandedvalue of path
<ejb-local-ref>
child of web-app
<ejb-ref>
child of web-app
<env-entry>
Environment Tags
child of cluster, host, web-app

All Environment tags are available to the <web-app>. For example, resources like <database>.

web-app database in resin-web.xml
<web-app xmlns="http://caucho.com/ns/resin">
  <database jndi-name="jdbc/test">
    <driver type="org.postgresql.Driver">
      <url>jdbc:postgresql://localhost/test</url>
      <user>caucho</user>
    </driver>
  </database>
</web-app>

Or IoC-configured Beans:

IoC bean in resin-web.xml
<web-app xmlns="http://caucho.com/ns/resin">
  <bean jndi-name="jdbc/test" type="example.Theater>
    <init name="Balboa Theater">
      <movie title="Attack of the Killer Tomatoes"/>

      <movie title="Snakes on a Plane"/>

      <movie title="Casablanca"/>
    </init>
  </bean>
</web-app>
<error-page>
child of web-app
error-codeSelect the error page based on an HTTP status code
exception-typeSelect the error page based on a Java exception
locationThe error page to display

By default, Resin returns a 500 Servlet Error and a stack trace for exceptions and a simple 404 File Not Found for error pages. Applications can customize the response generated for errors.

Catching File Not Found
<web-app xmlns="http://caucho.com/ns/resin">
  <error-page>
    <error-code>404</error-code>
    <location>/file_not_found.jsp</location>
  </error-page>
</web-app>
Catching Exceptions
<web-app xmlns="http://caucho.com/ns/resin">
   <error-page exception-type="java.lang.NullPointerException"
               location="/nullpointer.jsp"/>
</web-app>

The error page can use request attributes to obtain information about the request that caused the error:

/file_not_found.jsp
<%@ page session="false" isErrorPage="true" %>

<html>
<head><title>404 Not Found</title></head>
<body>
<h1>404 Not Found</h1>

The url <code>${'${'}requestScope["javax.servlet.error.request_uri"]}</code> 
was not found.
</body>
</html>

Request attributes for error handling

AttributeType
javax.servlet.error.status_codejava.lang.Integer
javax.servlet.error.messagejava.lang.String
javax.servlet.error.request_urijava.lang.String
javax.servlet.error.servlet_namejava.lang.String
javax.servlet.error.exceptionjava.lang.Throwable
javax.servlet.error.exception_typejava.lang.Class
<filter>

Defines a filter alias for later mapping.

filter-nameThe filter's name (alias)
filter-classThe filter's class (defaults to filter-name), which extends javax.servlet.Filter
init-paramInitialization parameters, see FilterConfig.getInitParameter

The following example defines a filter alias 'image'

<web-app xmlns="http://caucho.com/ns/resin">

  <filter>
    <filter-name>image</filter-name>
    <filter-class>test.MyImage</filter-class>
    <init-param>
      <param-name>title</param-name>
      <param-value>Hello, World</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>image</filter-name>
    <url-pattern>/images/*</url-pattern>
  </filter-mapping>

</web-app>

The full Servlet 2.3 syntax for init-param is supported as well as a simple shortcut.

<web-app id='/'>

<filter filter-name='test.HelloWorld'>
  <init-param foo='bar'/>

  <init-param>
    <param-name>baz</param-name>
    <param-value>value</param-value>
  </init-param>
</servlet>

</web-app>
<filter-mapping>

Maps url patterns to filters. filter-mapping has two children, url-pattern and filter-name. url-pattern selects the urls which should execute the filter.

filter-name can either specify a servlet class directly or it can specify a servlet alias defined by filter.

Servlet 2.4 definition for filter-mapping
filter-nameThe filter name
url-patternA pattern matching the url: /foo/*, /foo, or *.foo
dispatcher
Resin extensions to filter-mapping
url-regexpA regular expression matching the portion of the url that follows the context path
filter-nameThe filter name can use replacement vars from url-regexp like $1. It can also specify a class name directly like test.HelloWorldn/a
<web-app xmlns="http://caucho.com/ns/resin">

  <filter>
    <filter-name>test-filter</filter-name>
    <filter-class>test.MyFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>test-filter</filter-name>
    <url-pattern>/hello/*</url-pattern>
  </filter-mapping>

  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>test.HelloWorld</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
</web-app>

url-regexp matches the portion of the url that follows the context path. A webapp in webapps/ROOT, and a url http://localhost/foo/hello.html will have a value of "/foo/hello.html" for the purposes of the regular expression match. A webapp in webapps/baz and a url http://localhost/baz/hello.html will have a url of "/hello.html" for the purposes of the regular expression match, because "/baz" is the context path.

<form-login-config>
child of login-config

Configures authentication using forms. The login form has specific parameters that the servlet engine's login form processing understands. If the login succeeds, the user will see the original page. If it fails, she will see the error page.

Servlet 2.4 definition for form-login-config
form-login-pageThe page to be used to prompt the user loginnone
form-error-pageThe error page for unsuccessful loginnone
Resin extensions to form-login-config
internal-forwardUse an internal redirect on success instead of a sendRedirectfalse
form-uri-priorityIf true, the form's j_uri will override a stored URIfalse

The form itself must have the action j_security_check. It must also have the parameters j_username and j_password. Optionally, it can also have j_uri and j_use_cookie_auth. j_uri gives the next page to display when login succeeds. j_use_cookie_auth allows Resin to send a persistent cookie to the user to make following login easier.

j_use_cookie_auth gives control to the user whether to generate a persistent cookie. It lets you implement the "remember me" button. By default, the authentication only lasts for a single session.

j_security_checkThe form's mandatory action
j_usernameThe user name
j_passwordThe password
j_uriOptional Resin extension for the successful display page.
j_use_cookie_authOptional Resin extension to allow cookie login.

The following is an example of a servlet-standard login page:

<form action='j_security_check' method='POST'>
<table>
<tr><td>User:<td><input name='j_username'>
<tr><td>Password:<td><input name='j_password'>
<tr><td colspan=2>hint: the password is 'quidditch'
<tr><td><input type=submit>
</table>
</form>
<idle-time>
child of web-app

The <idle-time> specifies the timeout for lazy-idle web-apps. In some configurations, web-apps are created only on demand and are closed when no requests access the web-app. The idle-time configures when those web-apps should be freed.

The resin-doc web-app uses idle-time for its child web-apps because there are a large number of sub-web-apps for the individual tutorials..

<jsp>
child of web-app

Configures JSP behavior.

auto-compileAutomatically compile changed JSP filestrue
el-ignoredIgnore EL expressions in JSP textfalse
fast-jstlOptimize JSTL JSP compilationtrue
ignore-el-exceptionIgnore exceptions generated in EL expressionstrue
is-xmlDefault JSP pages to use XML syntaxfalse
precompileTry to load precompiled JSP pagestrue
recompile-on-errorRecompile the JSP file when an Error occurs in loadingfalse
require-sourceReturn 404 when JSP source is deletedfalse
dependency-check-intervalHow often to check the jsp for changes, -1 disablesinherited
sessionCreates sessions for each JSP pagetrue
<jsp-config>
<listener>
<locale-encoding-mapping-list>
<login-config>
child of web-appdefault no authentication
Servlet 2.4 definition for login-config
auth-methodAuthentication method, either BASIC for HTTP Basic Authentication, FORM for form based authentication, or DIGEST for HTTP Digest Authentication.
realm-nameThe realm name to use in HTTP authentication
form-login-configConfiguration for form login, see form-login-config
Resin extensions to login-config
typeDefines a custom class which extends com.caucho.server.security.AbstractLogin
initInitialization for the custom login class

HTTP Authentication is defined in the RFC HTTP Authentication: Basic and Digest.

HTTP digest authentication is discussed in Digest Passwords.

<message-destination-ref>
<message-destination>
<mime-mapping>
child of web-app

Maps url patterns to mime-types.

extensionurl extension
mime-typethe mime-type
<web-app id='/'>

  <mime-mapping>
    <extension>.foo</extension>
    <mime-type>text/html</mime-type>
  </mime-mapping>

  <!-- resin shortcut syntax -->
  <mime-mapping extension='.bar'
                mime-type='text/html'/>

</web-app>

Resin has a long list of default mime types in $RESIN_HOME/conf/app-default.xml

<multipart-form>
child of web-app

Enables multipart-mime for forms and file uploads. multipart-mime is disabled by default.

For an uploaded file with a form name of foo, the parameter value contains the path name to a temporary file containing the uploaded file. foo.filename contains the uploaded filename, and foo.content-type contains the content-type of the uploaded file.

upload-maxmaximum size of an upload request (in kb).no limit

If the upload is larger than the limit or if multipart-form processing is disabled, Resin will not parse the request and will set an error message in the "caucho.multipart.form.error" request attribute. The "caucho.multipart.form.error.size" will contain the attempted upload size.

Requests can set the maximum by setting the request attribute "caucho.multipart.form.upload-max" with an Integer or Long value.

By default, multipart-form is disabled.

<path-mapping>
child of web-app

Maps url patterns to real paths. If using a server like IIS, you may need to match the server's path aliases.

url-pattern>A pattern matching the url: /foo/*, /foo, or *.foo
url-regexpA regular expression matching the portion of the url that follows the context path
real-pathThe prefix of the real path. When used with url-regexp, allows substitution variables like $1.
<web-app xmlns="http://caucho.com/ns/resin">

<path-mapping url-pattern='/resin/*'
              real-path='e:\resin'/>

<path-mapping url-regexp='/~([^/]*)'
              real-path='e:\home\$1'/>

</web-app>
<redeploy-check-interval>
child of web-app

<redeploy-check-interval> specifies how often Resin should check if a .war file has been updated or added to a <web-app-deploy> directory.

default 60s
<redeploy-mode>
child of web-app

<redeploy-mode> specifies how Resin handles updates to web-apps and .war files. By default, Resin restarts web-apps when classes or configuration files change.

modedescription
automaticchecks for redeployment and auto-redeploy if modified
manualdoes not check for redeployment. Only checks if manual (JMX)
<resource-env-ref>
<resource-ref>
<rewrite-dispatch>
child of cluster, host, web-app

<rewrite-dispatch> defines a set of rewriting rules for dispatching and forwarding URLs. Applications can use these rules to redirect old URLs to their new replacements.

See rewrite-dispatch for more details.

Mediawiki dispatch in resin-web.xml
<web-app xmlns="http://caucho.com/ns/resin">

 <rewrite-dispatch>
   <dispatch regexp="\.(php|gif|css|jpg|png)"/>
   <forward regexp="^" target="/index.php"/>
 </rewrite-dispatch>

</web-app>
<secure>
child of web-app

The <secure> flag requires that the web-app only be accessed in a secure/SSL mode. Equivalent to a <security-constraint>.

<security-constraint>
child of web-app

Specifies protected areas of the web site. Sites using authentication as an optional personalization feature will typically not use any security constraints.

Security constraints can also be custom classes.

<security-constraint>
  <web-resource-collection>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <auth-constraint role-name='user'>
</security-constraint>
<security-role>
<servlet>

Defines a servlet alias for later mapping using servlet-mapping.

servlet-nameThe servlet's name (alias)
servlet-classThe servlet's class (In Resin, defaults to servlet-name)
init-paramInitialization parameters
load-on-startupInitializes the servlet when the server starts.
run-atTimes to execute the servlet automatically.
using the <servlet> tag
<web-app id='/'>

  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>test.HelloWorld</servlet-class>
    <init-param>
      <param-name>title</param-name>
      <param-value>Hello, World</param-value>
    </init-param>
  </servlet>

  <!-- using Resin shortcut syntax -->
  <servlet servlet-name='cron'
           servlet-class='test.DailyChores'>
    <init-param title='Daily Chores'/>
    <load-on-startup/>
    <run-at>3:00</run-at>
  </servlet>

  <!-- mapping a url to use the servlet -->
  <servlet-mapping url-pattern='/hello.html'
                   servlet-name='hello'/>

</web-app>

Several servlet configurations might configure the same servlet class with different init-param values. Each will have a separate servlet-name.

multiple servlets using the same class
<web-app>
  <servlet servlet-name='foo-a'>
    <servlet-class>test.FooServlet</servlet-class>
    <init-param name='foo-a sample'/>
  </servlet>

  <servlet servlet-name='foo-b'>
    <servlet-class>test.FooServlet</servlet-class>
    <init-param name='foo-b sample'/>
  </servlet>
</web-app>

load-on-startup can specify an (optional) integer value. If the value is 0 or greater, it indicates an order for servlets to be loaded, servlets with higher numbers get loaded after servlets with lower numbers.

There are a number of named servlets that are usually available to a Resin application, as defined in $RESIN_HOME/conf/app-default.xml.

servlet-mapping's in $RESIN_HOME/conf/app-default.xml
  <servlet servlet-name="directory"
           servlet-class="com.caucho.servlets.DirectoryServlet"/>

  <servlet servlet-name="file"
           servlet-class="com.caucho.servlets.FileServlet"/>

  <servlet servlet-name="jsp"
           servlet-class="com.caucho.jsp.JspServlet"/>

  <servlet servlet-name="xtp"
           servlet-class="com.caucho.jsp.XtpServlet"/>

<servlet servlet-name="j_security_check"
         servlet-class="com.caucho.server.security.FormLoginServlet"/>
<servlet-mapping>

Maps url patterns to servlets. servlet-mapping has two children, url-pattern and servlet-name. url-pattern selects the urls which should execute the servlet.

Servlet 2.4 definition for servlet-mapping
servlet-nameThe servlet namen/a
url-patternA pattern matching the url: /foo/*, /foo, or *.foon/a
Resin extensions to servlet-mapping
url-regexpA regular expression matching the portion of the url that follows the context pathn/a
servlet-nameThe servlet name can use replacement vars from url-regexp like $1. It can also specify a class name directly like test.HelloWorldn/a
<servlet-mapping>
<web-app id='/'>

  <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>test.HelloWorld</servlet-class>
  </servlet>

  <servlet-mapping>
    <url-pattern>/hello.html</servlet-class>
    <servlet-name>hello</servlet-class>
  </servlet-mapping>

  <!-- resin shortcut syntax -->
  <servlet-mapping url-pattern='*.xtp'
                   servlet-name='com.caucho.jsp.XtpServlet'/>

</web-app>

url-regexp matches the portion of the url that follows the context path. A webapp in webapps/ROOT, and a url http://localhost/foo/hello.html will have a value of "/foo/hello.html" for the purposes of the regular expression match. A webapp in webapps/baz and a url http://localhost/baz/hello.html will have a url of "/hello.html" for the purposes of the regular expression match, because "/baz" is the context path.

In Resin, the special servlet-name`invoker' is used to dispatch servlets by class name.

Warning Enabling the invoker servlet can create a security hole in your application. Any servlet in the classpath, perhaps even one in a .jar that you are unaware of, could be invoked.
servlet invoker
<web-app id='/'>

  <!-- 
    used with urls like 
    http://localhost:8080/servlets/test.HelloServlet 
  -->
  <servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>

</web-app>

There are a number of mappings to servlets that are usually available to a Resin application, as defined in $RESIN_HOME/conf/app-default.xml.

servlet-mapping's in $RESIN_HOME/conf/app-default.xml
<servlet-mapping url-pattern="*.jsp" servlet-name="jsp"/>
<servlet-mapping url-pattern="*.xtp" servlet-name="xtp"/>

<servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>
<servlet-mapping url-pattern="/" servlet-name="file"/>

The plugins use servlet-mapping to decide which URLs to send to Resin. The following servlet-name values are used by the plugins:

servlet-name values used by plugins
plugin_matchThe plugin will send the request to Resin, but Resin will ignore the entry. Use to get around regexp limitations. (Resin 1.2.2)
plugin_ignoreThe plugin will ignore the request. Use this to define a sub-url the web server should handle, not Resin. (Resin 1.2.2)
<servlet-regexp>

Maps URL by regular expressions to custom servlets.

<servlet-regexp url-regexp="/([^.]*).do"
                servlet-class="qa.\${regexp[1]}Servlet">
  <init a="b"/>
</servlet-regexp>
<session-config>

Session configuration parameters.

Servlet 2.4 definition for session-timeout
session-timeoutThe session timeout in minutes, 0 means never timeout.30 minutes

Resin add's a number of session-config tags.

Resin extensions to session-config
session-maxMaximum active sessions4096
enable-cookiesEnable cookies for sessions. (resin 1.1)true
enable-url-rewritingEnable URL rewriting for sessions. (resin 1.1)true
cookie-versionVersion of the cookie spec for sessions. (resin 1.2)1.0
cookie-domainDomain for session cookies. (resin 1.2)none
cookie-max-ageMax age for persistent session cookies. (resin 2.0)none
cookie-lengthMaximum length of the cookie. (resin 2.1.1)Integer.MAX_VALUE
file-storePersistent sessions using a file store. (resin 1.2)none
use-persistent-storeUses the current persistent-store to save sessions. (resin 3.0.8)none
always-load-sessionReload data from the store on every request. (resin 1.2)false
always-save-sessionSave session data to the store on every request. (resin 1.2)false
save-only-on-shutdownOnly save session when the application shuts down. (resin 1.2.3)false
reuse-session-idReuse the session id even if the session has timed out. A value of false defeats single signon capabilities. (resin 2.0.4)true
ignore-serialization-errorsWhen persisting a session, ignore any values which don't implement java.io.Serializablefalse
invalidate-after-listener. (resin 3.0)

By default, both enable-cookies and enable-url-rewriting are true. To force url rewriting, you would create a configuration like:

<web-app id='/'>

  <session-config
   enable-cookies='false'
   enable-url-rewriting='true'/>

</web-app>

The session-timeout and session-max are usually used together to control the number of sessions. Sessions are stored in an LRU cache. When the number of sessions in the cache fills up past session-max, the oldest sessions are recovered. In addition, sessions idle for longer than session-timeout are purged.

using session-config and session-timeout to control the number of sessions
<web-app id='/dir'>

  <session-config>
     <!-- 2 hour timeout -->
     <session-timeout>120</session-timeout>
     <session-max>4096</session-max>
  </session-config>

</web-app>

cookie-length is used to limit the maximum length for the session's generated cookie for special situations like WAP devices. Reducing this value reduces the randomness in the cookie and increases the chance of session collisions.

reuse-session-id defaults to true so that Resin can share the session id amongst different web-apps.

The class that corresponds to <session-config> is com.caucho.server.session.SessionManager

<shutdown-wait-max>

The maximum time Resin will wait for requests to finish before closing the web-app.

default 15s
<strict-mapping>
default false, allowing /foo/bar.jsp/foo.

Forces servlet-mapping to follow strict Servlet 2.2, disallowing PATH_INFO. Value is true or false.

<web-app>
  <strict-mapping>true</strict-mapping>
</web-app>
<user-data-constraint>
child of security-constraint

Restricts access to secure transports, such as SSL

transport-guaranteeRequired transport properties. NONE, INTEGRAL, and CONFIDENTIAL are allowed values.
<web-app>
child of host, web-app

web-app configures a web application.

idThe url prefix selecting this application.n/a
url-regexpA regexp to select this application.n/a
document-directoryThe document directory for the application, corresponding to a url of /id/. A relative path is relative to the root-directory of the containing host. Can use regexp replacement variables.A relative path constricted with the id or the regexp match
startup-mode`automatic', `lazy', or `manual', see Startup and Redeploy Modeautomatic
redeploy-mode`automatic' or `manual', see Startup and Redeploy Modeautomatic

When specified by id, the application will be initialized on server start. When specified by url-regexp, the application will be initialized at the first request. This means that load-on-startup servlets may start later than expected for url-regexp applications.

The following example creates a web-app for /apache using the Apache htdocs directory to serve pages.

<host id=''>
  <web-app id='/apache' document-directory='/usr/local/apache/htdocs'>

  ...

</host>

The following example sets the root web-app to the IIS root directory.

  <web-app id='/' document-directory='C:/inetpub/wwwroot'>

When the web-app is specified with a url-regexp, document-directory can use replacement variables ($2).

In the following, each user gets his or her own independent application using ~user.

<host id=''>

  <web-app url-regexp='/~([^/]*)'
           document-directory='/home/$1/public_html'>

    ...

  </web-app>

</host>
<web-app-default>
child of cluster, host, web-app

Establishes the defaults for a web-app.

When initializing a web-app, all the tags in the web-app-defaults sections configure the web-app. In other words, the web-app-default value is essentially a macro that is cut-and-pasted before the web-app configuration.

web-app-default is used for defining server-wide behavior, like *.jsp handling, and for host-wide behavior.

<host>
  <web-app-default>
    <servlet servlet-name='test'
             servlet-class='test.MyServlet'/>

    <servlet-mapping url-pattern='*.text' servlet-class='test'/>
  </web-app-default>
</host>
<web-app-deploy>
child of host, web-app

Specifies war expansion.

web-app-deploy can be used in web-apps to define a subdirectory for war expansion. The tutorials in the documentation use web-app-deploy to allow servlet/tutorial/helloworld to be an independent war file.

pathThe path to the webapps directoryrequired
url-prefixurl-prefix added to all expanded webapps""
expand-pathdirectory where wars should be expandedvalue of path
lazy-inittrue if web-apps should only be initialized when first usedfalse
web-app-defaultdefaults to be applied to expaned web-apps
web-appoverriding configuration for specific web-apps

The web-app-deploy can override configuration for an expanded war with a matching <web-app> inside the <web-app-deploy>. The <document-directory> is used to match web-apps.

overriding web.xml
<web-app-deploy path="webapps">
  <web-app context-path="/wiki"
              document-directory="wiki">
    <context-param database="jdbc/wiki">
  </web-app>
</web-app-deploy>
<web-resource-collection>
child of security-constraint

Specifies a collection of areas of the web site.

web-resource-namea name for a web resource collection
description
url-patternurl patterns describing the resource
http-methodHTTP methods to be restricted.
method
<welcome-file-list>
child of web-app

Sets the files to use as when no filename is present in url. According to the spec, each file is in a <welcome-file> element.

<web-app xmlns="http://caucho.com/ns/resin">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.xtp</welcome-file>
    <welcome-file>home.xtp</welcome-file>
  </welcome-file-list>
</web-app>

Resin also provides a shortcut where you can just list the files:

<web-app xmlns="http://caucho.com/ns/resin">
  <welcome-file-list>
    index.jsp, index.xtp, home.xtp
  </welcome-file-list>
</web-app>
default in $RESIN_HOME/conf/app-default.xml is index.xtp, index.jsp, index.html.
<web-service>
child of web-app

The <web-service> tag configures a bean as a service. The service can receive request from multiple protocols, including REST, SOAP, Hessian, and direct local-JVM calls. The service will normally be configured with IoC.

See the web-service documentation for more information.

See the hello world tutorial for an example.

classDefines the implementation class for the web-servicerequired
hessianAdds a Hessian port for the web service.
initIoC-based initialization. See IoC init documentation for more information.
jndi-nameSpecifies the jndi-name to store the web service for lookup by local-JVM clients.
restAdds a REST interface for the web service.
soapAdds a SOAP interface for the web service.
varSets a Resin EL-variable for IoC injection for other beans in the resin.conf.
web-service definition
element web-service { class & hessian* & init* & jndi-name? & rest* & soap* & var? }

<host>
tags
<database>
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin ® is a registered trademark, and Quercustm, Ambertm, and Hessiantm are trademarks of Caucho Technology.