HTTP and Srun configuration is identical except for load balancing (
and .)HTTP configuration follows the Servlet 2.2 deployment descriptors. The nesting depth is important, but order is generally not important. In the sections that follow, the section header tells where the attribute belongs. For example, the
configuration in looks like:
|
Most of the interesting configuration belongs in web-app. For example,
belongs in a element, but belongs in the top-level element.The server contains a number of
elements and each contains elements. Each configures a virtual host and each configures an application.
|
access-log | Specifies the access log file |
alternate-session-url-prefix | Configures an alternate URL prefix to be used for /~J=xxx/test |
cache | Activates the memory cache with a specified size |
doc-dir | Specifies the document directory for the |
error-log | Specifies the file for error logging |
error-page | The url to display if the web server can't connect to Resin |
forbid-host | Selects a list of IPs that are forbidden |
global-system-properties | Determines if system-properties are classloader specific or global |
host | Defines a virtual host |
http | Defines a HTTP or SSL port for the standalone server |
http-server | Configuration for the servlet engine |
ignore-client-disconnect | Ignores ClientDisconnectionExceptions thrown when the browser disconnects |
ping | Specifies a list of URLs to test to check the webserver's uptime |
root-dir | Specifies the root directory for the |
server-listener | Specifies the classname for a listener when the server starts and shuts down |
server-name | Defines the canonical url for the host |
servlet-classloader-hack | Enables the Servlet specification classloader hack |
session-cookie | Configures session cookie |
session-url-prefix | Configures the URL prefix to be used for url-rewriting |
srun | Defines multiple client machines for load balancing |
srun-backup | Defines backup client machines for load balancing |
sticky-sessions | Enables or disables sticky-session load balancing |
thread-keepalive | Number of threads to be used in keepalive requests |
thread-max | Maximum number of request-handling threads |
url-character-encoding | Defines the character encoding to be used for decoding the URL |
url-length-max | Specifies the maximum length allowed in a HTTP URL |
war-dir | Specifies a special directory to place war files |
war-expand-dir | Specifies the destination of war expansion |
web-app | Specifies an application |
http-server |
Configuration for the servlet engine.
Any
Default application tags like
alternate-session-url-prefix |
Resin 2.0.5 |
Configures an alternate URL prefix to be used for /~J=xxx/test.jsp style url-rewriting. There is no default.
If alternate-session-url-prefix is configured, URL rewriting will add the session to the beginning of the URL as a path prefix instead of the standard ;jsessionid= suffix. For clients like mobile devices with limited memory, this will allow careful web designers to minimize the page size.
... |
cache |
Resin 1.1 |
Activates the memory cache with a specified size. Resin's cache acts as a proxy cache. Pages with
headers will be cached, avoiding expensive Java or Database processing.To activate caching, you must add a cache directive. By default, caching is disabled.
The cache combines memory and file caching. The most referenced pages are served out of memory and the rest are served from the filesystem.
Attribute | Meaning | Default |
---|---|---|
dir | File directory to store the cached pages | resin1.2/cache |
entries | Number of entries allowed in the memory cache | 16386 |
size | Size in kilobytes of the memory | 1024 |
enable | true or false to disable | true |
For example, a page created by several sophisticated and slow database queries may only change every 15 minutes. If that page sets its expires header, Resin can serve the generated page as fast as a static page.
Default: by default, cache is disabled.
Specifies the file for error logging. The log is relative to $RESIN_HOME. You can use the special path
to make the log relative to the host, e.g. .
|
Attribute | Meaning | Default |
---|---|---|
encoding | character encoding | The JVM's default |
href | The log's filename | required |
rollover-period | How often the log should be rotated | never |
rollover-size | How large the log can be before rotating | infinite |
timestamp | Format for a timestamp before each entry | none |
Default: By default, a host's error log will use an error-log defined in http-server.
The url to display if the web server can't connect to Resin. This is a special case of error-page in the web-app configuration.
The Apache and IIS plugins use this special error-page directive to display a custom error page when the web server can't connect to Resin. The location must be an absolute path understandable to the web server.
|
forbid-host |
Resin 2.0.3 |
Selects a list of IPs that are forbidden.
|
forbid-host is implemented by com.caucho.http.security.ForbidHost. It is stored in JNDI as java:comp/env/caucho/forbid-host. An intelligent log might detect a denial of service attack and dynamically forbid the host.
ignore-client-disconnect |
Resin 1.2.3 |
Ignores ClientDisconnectionExceptions thrown when the browser disconnects.
|
False by default, throws exceptions on disconnects.
global-system-properties |
Resin 2.0.5 |
Determines if system-properties are classloader specific or global.
By default, Resin's web-apps and hosts have isolated system properties. So System.getProperty("test") in host foo.com might return a different value from System.getProperty("test") in host bar.com. Usually, this is the correct solution to prevents hosts and web-apps from affecting each other. Specialized applications may want to disable this feature however.
... |
Default: The default value is false.
Defines a virtual host. If no hosts are specified, or if a request doesn't match a host, configuration in http-server will be used instead.
The id may contain a list of hosts. Any host in the list will match.
See application configuration for servlet configuration.
Hosts can use
instead of to dynamically create new hosts.
Attribute | Meaning | Default |
---|---|---|
id | The host name | required |
regexp | A regular expression matching hosts. | none |
app-dir | The root directory of the host (can use replacement vars) | use http-server app-dir |
Any
Default application tags like
|
Note: Only the Resin Java process understands regexps. Because mod_caucho, isapi_srun and the other web server plugins don't understand the regexps, you may need to do additional work to make the web server send the request to Resin.
Default: If the
http |
Resin 1.2 |
Defines a HTTP or SSL port for the standalone server.
Attribute | Meaning | |
---|---|---|
id | http identifier name | |
host | The listening host | |
port | The listening port | |
virtual-host | Virtual host to select a host block. | |
ssl | enable ssl | |
key-store-type | JSSE Type of the key store (default jks) | |
key-store-file | JSSE File containing the certificates | |
key-store-password | JSSE Password to read the certificates | |
key-manager-factory | JSSE key manager factory type | |
ssl-context | JSSE ssl context type | |
certificate-file | OpenSSL certificate (Resin 2.0.5) | |
certificate-key-file | OpenSSL key certificate (Resin 2.0.5) | |
certificate-key-password | OpenSSL key password (Resin 2.1.1) | |
crypto-device | OpenSSL engine (Resin 2.0.5) | |
thread-max | Maximum number of live threads. | 200 |
thread-min | Minimum number of live threads. | 5 |
thread-keepalive | Number of keepalive threads | 100 |
request-timeout | Max time for a request, after this the request will be interrupted. | 30 sec |
listen | Value of the socket listen parameter | 5 |
accept-buffer-size | Number of sockets in the accept buffer. | 256 |
shutdown-wait-time | How long to wait for connections to finish before exiting. | 10 sec. |
|
|
Specifies a list of URLs to test to check the webserver's uptime. Ping adds reliability to a web site. It launches a separate thread to check if a list of URLs return valid results, i.e. HTTP status 200. If the URLs fail after repeated attempts, Resin will exit. The parent process, either wrapper.pl or the NT service, will automatically restart Resin.
Because the ping thread is in the same JVM as the web server, ping cannot detect all failure types. In particular, if the JDK itself freezes, ping can do nothing. It can detect problems like deadlocks or database connection overflows or memory leaks.
The URLs listed in the
Attribute | Meaning | Default |
---|---|---|
url | URL to test for failure | required |
sleep-time | time to sleep between pings. | 15 min |
retry-count | how many times to retry failures before restarting. | 3 |
retry-time | how long to sleep between failures. | 1 sec |
class-name | specify a custom ping class (Resin 2.0.3) | com.caucho.http.admin.PingThread |
socket-timeout | how long the socket should wait for a response before timing out. | 10s |
|
Custom ping classes must extend com.caucho.http.admin.PingThread. For example, the PingMailer will mail when the PingThread fails.
Attribute | Meaning | Default |
---|---|---|
mail-to | Recipient of the warning mail | required |
mail-from | Sender of the mail | the user of the Resin process |
mail-subject | The subject of the mail | "Resin ping has failed" |
|
No default.
srun |
Resin 1.1 |
Defines multiple client machines for load balancing. This directive used by the web server (Apache or IIS) and by the Java portion of Resin.
Each
Attribute | Meaning | Default |
---|---|---|
id | srun identifier name. | none |
host | The host name of the client srun. | all interfaces |
port | The port name of the client srun. | none |
connect-timeout | How long to wait for a connection from the web server to the Resin srun before giving up. | 30 sec |
live-time | How long the web-server/srun connection should stay live. | 10 sec |
dead-time | How long before checking that a srun has come back up. | 5 sec |
timeout | How long the load balancing server should wait for a response. | 30 sec |
thread-max | Maximum number of live threads. | 200 |
thread-min | Minimum number of live threads. | 5 |
thread-keepalive | Number of keepalive threads | 100 |
request-timeout | Max time for a request, after this the request will be interrupted. | 30 sec |
listen | Value of the socket listen parameter | 5 |
accept-buffer-size | Number of sockets in the accept buffer. | 256 |
shutdown-wait-time | How long to wait for connections to finish before exiting. | 10 sec. |
|
To start srun 'a' use a command line like
unix> Resin 2.1.0srun listening to host1.caucho.com:6802 |
On Unix, when starting a daemon, you'll need to specify a unique pid file.
unix> |
srun-backup |
Resin 1.1 |
Defines backup client machines for load balancing. This directive is only picked up by the load balancer. The Java portion of Resin treats a
Attribute | Meaning | Default |
---|---|---|
id | srun identifier name | none |
host | The host name of the client srun | all interfaces |
port | The port name of the client srun | none |
connect-timeout | How long to wait for a connection from the web server to the Resin srun before giving up. | 30 sec |
live-time | How long a keepalive connection will remain alive before closing. | 5 sec. |
dead-time | How long to treat a non-responding srun before trying again. | 5 sec. |
shutdown-wait-time | How long to wait for connections to finish before exiting. | 10 sec. |
Number of threads to be used in keepalive requests. When Resin is used in combination with a web server, like Apache or IIS, Resin will reuse the socket connection to that web server if possible.
specifies the number of theads that can be used in these keepalive connections.Defaults to 100.
Maximum number of request-handling threads.
Defaults to 200.
host |
Specifies the access log file. The log is relative to $RESIN_HOME. You can use the special path
to make the log relative to the host, e.g. .
Attribute | Description | Default |
---|---|---|
id | The access log path. | required |
format | Access log format. | see below |
class-name | Class implementing AbstractAccessLog for custom logging. | |
rollover-period | how often to rollover the log. Normally in days (15D), weeks (2W) or months (1M). | none |
rollover-size | max size of the log before a rollover. | 10 meg |
archive-format | format the name of the archive file. | n/a |
The
variable controls how often the access log will be rotated. When the time runs out, Resin will move the old log file to a timestamped one, e.g. access.log20001114. Rollovers happen at midnight in the local time if the time period is a day or longer.The access log formatting variables follow the Apache variables:
%b | result content length |
%h | remote IP addr |
%{ | }irequest header |
%{ | }oresponse header |
%{ | }ccookie value |
%n | request attribute |
%r | request URL |
%s | status code |
%{ | }trequest date with optional time format string. |
%T | time of request in seconds |
%u | remote user |
%U | request URI |
The default format is:
"%h %l %u %t /"%r/" %>s %b /"%{Referer}i/" /"%{User-Agent}i/"" |
|
If the web-app doesn't specify an access-log, it will use the host's access-log.
doc-dir |
Resin 2.1 |
Specifies the document directory for the
|
Default: Defaults to
root-dir |
Resin 2.1 |
Specifies the root directory for the
|
Default: Hosts defaults to the
session-cookie |
Resin 2.1.2 |
Configures session cookie. The default is "JSESSIONID".
session-url-prefix |
Resin 2.0 |
Configures the URL prefix to be used for url-rewriting. The default is ";jsessionid=".
server-name |
Resin 2.0.4 |
Defines the canonical url for the host. In some cases, the specific URL that's used for a virtual host might be different from the
... |
server-listener |
Resin 2.0.3 |
Specifies the classname for a listener when the server starts and shuts down. The class must be in the system classpath because it's called before the dynamic classpaths have been created and after they've been destroyed.
The server listener class must extend com.caucho.http.admin.AbstractServerListener.
|
servlet-classloader-hack |
Resin 2.0.3 |
Enables the Servlet specification classloader hack. The Servlet 2.3 classloader order violates the JDK classloader specification. By default, therefore, Resin follows the JDK requirements. Those application which need to violate the JDK spec may enable the servlet-classloader-hack.
By default, the hack is disabled.
sticky-sessions |
Resin 2.0 |
Enables or disables sticky-session load balancing.
The default is true to enable sticky sessions.
Defines the character encoding to be used for decoding the URL. Because the HTTP protocol does not specify the encoding to be used, the server must specify the encoding beforehand.
Default: utf-8
Specifies the maximum length allowed in a HTTP URL. Requests with longer lengths will receive an error.
Default: 8192
Specifies a special directory to place war files. Any .war (web-application resource) file placed in the war directory will be automatically expanded and installed. The .war file will be expanded into
, if specified.The war-dir is relative to $RESIN_HOME, not to the virtual host's app-dir.
|
Given the above example, if you put foo.war in resin1.2/foo-apps, Resin will automatically expand it and install it with the prefix
. So browsing will give the top-level contents.Generally, war files use
for configuration. The syntax is the same as for other application configuration.No war-dir is defined by default.
war-expand-dir |
Resin 1.2.3 |
Specifies the destination of war expansion. Any .war (web-application resource) file placed in the war-dir directory will be automatically expanded into war-expand-dir. You can also create a web-app by creating a directory in war-expand-dir.
The war-dir is relative to $RESIN_HOME, not to the virtual host's app-dir.
The special directory
lets you define the root web-app.Generally, war files use
for configuration. The syntax is the same as for other application configuration.Default: Defaults to the value of
Specifies an application. Applications are self-contained subtrees of the web site. They have distinct Application objects, sessions, and servlet mappings. Applications can even be deployed entirely from .jar files.
The full application configuration is described in a separate page.
Applications have a root
similar to the document root. By default, it's just the same as the relative path.Beneath the
root, a special directory contains servlet classes and beans. contains Java source files and Java classes. contains additional jar files for the application.
Attribute | Meaning | Default |
---|---|---|
id | The url prefix of the application. | required |
url-regexp | A regular expression matching a url prefix. | none |
app-dir | The application's root directory. | The subdirectory of the host's app-dir named by |
|
The
configuration allows for dynamic applications, for example, creating a new application for each user.
|
In the above example, users will put their own web.xml in
. Classes belong in .Note: Only the Resin Java process understands regexps. Because mod_caucho, isapi_srun and the other web server plugins don't understand the regexps, you may need to do additional work to make the web server send the request to Resin.
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1555396