
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
basic configuration in the
tutorial section.
System-specific installation information is in
a different section.
|
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.
<caucho.com> <http-server>
<http port='8080'/>
<host id=''> <app-dir>/home/ferg/public_html</app-dir>
<web-app id='/'> <servlet-mapping> <url-pattern>/servlet/*</url-pattern> <servlet-name>invoker</servlet-name> </servlet-mapping>
<servlet> <servlet-name>jsp</servlet-name> <servlet-class>com.caucho.jsp.JspServlet</servlet-class> </servlet>
<servlet-mapping> <url-pattern>*.jsp</url-pattern> <servlet-name>jsp</servlet-name> </servlet-mapping> </web-app> </host>
</http-server> </caucho.com>
|
The following description condenses the full
configuration summary.
caucho.com ::= http-server
http-server ::= http* |
srun* |
host*
host ::= app-dir |
web-app*
web-app ::= servlet-mapping* |
servlet*
servlet ::= servlet-name |
servlet-class |
init-param*
servlet-mapping ::= url-pattern |
servlet-name
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
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>
|
Copyright © 1998-2001 Caucho Technology. All rights reserved.
| Copyright © 1998-2001 Caucho Technology. All rights reserved.
|
 |
|