Resin-web.xml

From Resin 3.0

Revision as of 08:15, 7 December 2011 by Pcowan (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
40px-Edit-clear.png This article requires cleanup and may refer to a legacy version of Resin.

Please visit http://www.caucho.com/documentation/ for the most up-to-date documentation.

The resin-web.xml file, located in WEB-INF, is the place to configure Resin-specific web-app configuration. All the usual web.xml directives are supported as well as simplifying the web.xml syntax to make the configuration more readable.

Since most applications will only be deploying to a single web server, they will typically just create a resin-web.xml as the configuration file in WEB-INF. Applications which expect to deploy in multiple web servers will generally create a web.xml with servlet-standard configuration and a separate resin-web.xml for additional configuration for databases and other resources.

For validation, the resin-web.xml should declare the Resin validation namespace: http://caucho.com/ns/resin. This will let Resin catch XML configuration errors early and give information about the errors.

resin-web.xml

<resin xmlns="http://caucho.com/ns/resin">
  <database ...>
  </database>

  <servlet>
    ...
  </servlet>

  <servlet-mapping>
    ...
  </servlet-mapping>
</resin>


Resin reads the web.xml and resin-web.xml in order, so configuration in the resin-web.xml can override the configuration in the web.xml.

Since Resin 3.0 tries to avoid defaults, the import of web.xml and resin-web.xml is defined in the conf/app-default.xml file as follows:

app-default.xml

<server xmlns="http://caucho.com/ns/resin"
        xmlns:resin="http://caucho.com/ns/resin/core">

<web-app-default>
  ...
  <resin:import path="WEB-INF/web.xml" optional="true"/>
  <resin:import path="WEB-INF/resin-web.xml" optional="true"/>
</web-app-default>
</server>
Personal tools