Because the flexibility of Resin's configuration can be overwhelming, we've
collected the most important configuration here. Once you understand the
basic configuration, you can use it as a framework to attach more detailed
configuration as you need it.
You may want to look at:
Configuring Resin involves configuring the following:
Resin organizes classes and JNDI resources into a tree.
Each node in the tree inherits classes and JNDI resources from
its parents and adds it's own classes and resources. So a database
jdbc/test configured for the foo.com virtual host would
be available for every web-app in the host.
Complete resin.conf Example |
The following creates a basic working configuration for a Resin standalone
configuration. Resin will compile and load servlets and classes placed
in /home/ferg/public_html/WEB-INF/classes and jars placed in
in /home/ferg/public_html/WEB-INF/lib.
The url /servlet/test.MyServlet will invoke a servlet in
/home/ferg/public_html/WEB-INF/classes/test/MyServlet.class.
The url /hello.jsp will run a JSP in
/home/ferg/public_html/hello.jsp.
Example resin.conf
<caucho.com>
<http-server>
<http port='8080'/>
<host id=''>
<doc-dir>/home/ferg/public_html</doc-dir>
<war-dir>webapps</war-dir>
<web-app id='/'>
</web-app>
</host>
</http-server>
</caucho.com>
|
Servlet configuration normally belongs in the web.xml in the WEB-INF
directory. Resin-specific configuration, e.g. database configuration,
belongs in a resin.xml file in WEB-INF or in the resin.conf.
Because Resin merges the contents of resin.xml, web.xml, and resin.conf,
so you can put everything in the resin.conf if that makes your application
easier to maintain.
The following web.xml configures the special "invoker" servlet, which lets
you call servlets using the classname in the URL like
/servlet/qa.MyServlet. In general, it's a better idea to create specific
servlet-mappings for each servlet for better security.
Example /WEB-INF/web.xml
<web-app>
<servlet-mapping>
<url-pattern>/servlet/*</url-pattern>
<servlet-name>invoker</servlet-name>
</servlet-mapping>
</web-app>
|
Index |
caucho.com | caucho |
host | Each http-server contains some
virtual hosts |
http | Configures the HTTP port for Resin to listen at |
http-server | http-server contains all
configuration for the Resin server |
servlet | Defines a servlet alias for later mapping |
servlet-mapping | Maps url patterns to servlets |
srun | Configures a servlet runner port for Resin to listen at |
web-app | Each host contains some web
applications |
caucho.com is just a container for any Caucho configuration
http-server contains all
configuration for the Resin server.
The most important configuration variable is app-dir.
app-dir configures the document root. app-dir can appear
in <http-server>, <host>, and <web-app>.
If it's not specified, it defaults to the parent.
Apache Config
<caucho.com>
<http-server>
<app-dir>/usr/local/apache/htdocs</app-dir>
...
</http-server>
</caucho.com>
|
IIS Config
<caucho.com>
<http-server>
<app-dir>d:\inetpub\wwwroot</app-dir>
...
</http-server>
</caucho.com>
|
Resin Config
<caucho.com>
<http-server>
<app-dir>doc</app-dir>
...
</http-server>
</caucho.com>
|
Configures the HTTP port for Resin to listen at.
Attribute | Meaning | Default
|
port | TCP post to listen to | required
|
host | TCP interface to listen to | all interfaces
|
<caucho.com>
<http-server>
<http host='localhost' port='6802'/>
...
</http-server>
</caucho.com>
|
Configures a servlet runner port for Resin to listen at.
Attribute | Meaning | Default
|
port | TCP post to listen to | required
|
host | TCP interface to listen to | all interfaces
|
<caucho.com>
<http-server>
<srun host='localhost' port='6802'/>
...
</http-server>
</caucho.com>
|
Each http-server contains some
virtual hosts. Most
configurations will use the default host.
<caucho.com>
<http-server>
<host id=''>
...
</host>
</http-server>
</caucho.com>
|
Each host contains some web
applications. A web application is just a container for
some servlets. It's closely related to the
javax.servlet.ServletContext.
Most configurations will use the default web-app.
<caucho.com>
<http-server>
<host id=''>
<web-app id='/'>
...
</web-app>
</host>
</http-server>
</caucho.com>
|
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.
The special servlet-name invoker is used to dispatch
servlets by class name. For example, /servlets/test.HelloServlet.
url-patterns
/path/to/servlet | Exact URL match
|
/prefix/* | Matching everything with a prefix
|
*.jsp | Matching everything with an extension
|
/ | Replace the default servlet
|
In the following example, the URL /hello-world invokes the servlet
<web-app id='/'>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>test.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<url-pattern>/hello-world</url-pattern>
<servlet-name>hello</servlet-name>
</servlet-mapping>
<servlet-mapping>
<url-pattern>*.xtp</url-pattern>
<servlet-name>com.caucho.jsp.XtpServlet</servlet-name>
</servlet-mapping>
</web-app>
|
Defines a servlet alias for later mapping. More details are in the
servlet configuration section.
servlet-name | The servlet's name (alias)
|
servlet-class | The servlet's class (defaults to servlet-name)
|
init-param | Initialization parameters
|
In the following example, the url /hello.xtp invokes the
servlet test.HelloWorld. The servlet will use getInitParameter("title") to get the string "Hello, World".
<web-app id='/'>
<servlet-mapping>
<url-pattern>/hello.xtp</url-pattern>
<servlet-name>hello</servlet-name>
</servlet-mapping>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>test.HelloWorld</servlet-class>
<init-param title='Hello, World'/>
</servlet>
</web-app>
|
The following description condenses the full
configuration summary.
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc. | |
|