|
Resin configuration is based on the file located in . It's XML-based, although it allows for some non-XML laziness like omitting quotes from attributes.The application configuration is based on the Servlet 2.2 deployment descriptor. The configuration file parses into a (key, value) structure. LISP fans will recognize it as similar to an A-list and Windows fans will recognize it as similar to the NT registry. Unlike either, though, multiple items with the same key are allowed.
Note: Because the internal format has less structure than XML does, you can use either an element-based configuration or an equivalent attribute-based configuration. You should use whichever configuration simplifies your maintenance. The following example uses the element-based configuration exclusively.
Despite its name, contains configuration for the standalone HTTP server and the servlet runner. In fact, you can listen to multiple HTTP and servlet runner ports in the name .In the current version of Resin only allows a single .can be used in the http-server, as above, in the host and in the web-app. If unspecified, it defaults to the directory of the enclosing block. The sample resin.conf in the distribution points to an app-dir . If you start Resin from the distribution, you can put a hello.jsp in and you'll view it from a browser using .Application servlets and classes belong in and jars belong in . Resin will automatically reload a class placed in either location. External jars, for example a database driver, should be put in instead.The directory is hidden by the web server. So, it is not possible for a browser to look at anything in that directory.Note: JNI. Because of the way Java handles JNI, you should place the Java classes outside the directories, putting them in or instead. That means you'll need to restart Resin when you change those classes, so you should only put the interface classes outside WEB-INF.Configurations using Resin as a servlet runner for another web server will use an srun tag to listen for the servlet runner. Resin 1.2 allows multiple id attribute. and tags. A virtual host configuration might use separate tags for each IP interface on the server. A load balancing configuration will use several tags, each representing a different backend server, and selected by theTo configure a virtual host, just copy the default app-dir for the new virtual host so it will use a different application directory than the default host. block and set the attribute to the host name. You'll probably want to set theThe web-app with app-dir. If unspecified, as in the example, it defaults to the path below the host's app-dir. A web-app starts in and the WEB-INF will be . is the default web application. It's a good idea not to go overboard in creating web-apps. Most sites should just use the single default. Each web-app has its ownServlet configuration follows the Servlet 2.2 deployment descriptor configuration. The servlet tag assigns a name to a servlet and specifies its class. Servlets which need configuration will use init-param to configure servlet parameters. To actually use a servlet, you'll need to add a servlet-mapping tag for each servlet. Each tag specifies a separate servlet instance. You can create several servlet instances, each with different init parameters and different names, by creating multiple tags.Servlets and their supporting classes generally belong in or in a jar in . A servlet class would belong in . Resin will automatically reload the servlets when they change. You can put servlets and their classes in the system classpath, for example, , but they will not be reloaded automatically.specifies the URLs that invoke a servlet. The longest match between the URL and all the entries will select the servlet. If none of the entries match, Resin will serve the URL as a static file. With a web-server like Apache, the servlet-mapping entries determine which URLs belong to Resin and which belong to Apache. Any match belongs to Resin and a non-match will belong to Apache. You can use the special URL to look at the mapping.The url-pattern specifies the URLs to match. The four patterns in the Servlet specification are , , , and . The in the matches a in a . As a Resin extension, you can specify all the configuration in the itself, avoiding the double entry.
|