Table of Contents Previous Next Index

Section 25 Adding Content to the Tomcat Server

Section 25 Adding Content to the Tomcat Server
In LISTSERV Maestro, the various parts that are served by Tomcat are called “contexts”. Each context is an entity of its own inside of the Tomcat server. Each context has a name, which is also part of the URL that you use to access the context. More precisely, the context’s name is the part which appears right after the server name. For example, for LUI, the context name is lui, so the URL is http://yourhost/lui. Other LISTSERV Maestro contexts are hub, trk, list, archives, and scripts, with the respective URLs (http://yourhost/hub, http://yourhost/list, etc).
If you enter a context’s access URL (as above), what you actually get is the default page for that context (usually a page called index.html, index.jsp, default.htm, etc.). Therefore, if you type http://yourhost/lui, then what you actually get is the default page for the lui context (http://yourhost/lui/index.jsp).
To add content of your own (for example HTML pages, images, downloadable files, etc.) to the Tomcat installation of LISTSERV Maestro, you simply create a new context and put your files into that context. The files are then accessible using the URLs in that context.
Out of the box, Maestro does not support content or pages that are not part of a context. However, it is possible to support such content or pages once some additional configuration steps are taken (see Section 25.2 Defining the Default Context for details).
25.1 Adding Content as a New Context
To create a new context, create a folder (with the name of the context) in the webapps folder of LISTSERV Maestro. For example, if you want to create a new context called sample, then you would create the following folder:
[install_folder]\webapps\sample\
Copy the following folder (and the files in it) from the archives context to your newly created context:
[install_folder]\webapps\archives\WEB-INF\
(The archives context is automatically installed with each Maestro Tomcat.
After you copy this folder into your new folder, you will have:
[install_folder]\webapps\sample\WEB-INF\
In the WEB-INF folder that you just copied, edit the web.xml file and look for the <param-value>archives</param-value> entry. Change the text “archives” to the name of your context, i.e. so that you end up with something like this:
<param-value>sample</param-value>
You can now put whatever files you want into the sample folder (you can also create subfolders). You may want to include a start page, such as index.html or similar, but you can also have other pages, image files, or other downloadable content if you want (even in subfolders). These files would then be accessed as follows:
access to the start page
(if one was supplied)
access to page.html
access to other.html in the sub subfolder
Restart Maestro to make it aware of the new context.
Important: Do not create custom contexts with one of the reserved names used by LISTSERV Maestro (i.e. do not call your context lui, hub, trk, list, archives, or scripts).

Do not put any files into the WEB-INF folder, as they would not be accessible via a URL.

Do not create a folder or subfolder called META-INF. This is a reserved name.
25.2 Defining the Default Context
The default context is the context used if the user types the access URL without any context name, such as http://yourhost or http://yourhost/somepage.html.This is not supported out of the box by Maestro; instead, it must be configured.
To define a default context, create a new context (with a new subfolder in “webapps”) as described in the Section 25.1 Adding Content as a New Context.
In addition, before restarting Maestro, include the following entry in the tomcat.ini:
DefaultContext=CONTEXT_NAME_HERE
where you replace CONTEXT_NAME_HERE with the name of your context (for example, DefaultContext=sample, making the sample context the default).
Note: Do not define any of the reserved LISTSERV Maestro contexts as the default context (lui, hub, trk, list, archives, or scripts)
With this entry in the tomcat.ini, the given default context (“sample” in this case) can now be accessed in two ways:
access to page.html
access to other.html in the sub subfolder
In addition, you can leave out the context in the URL but will still see the same pages (but this works only for the default context, of course):
access to page.html in the root folder of the default context
access to other.html in the sub subfolder of the default context
25.3 Enabling Access Logging for Added Content
If you add your own content to be served by the Tomcat server, then you might also want to enable the usual web server logging for this content.
With enabled access logging, Tomcat will create log files in the same format as those created by standard web servers. These logs can later be analyzed by standard log analysis tools to track page hit counts, user session activity, and so on. The log files are created separately (under different names) for all contexts for which access logging is enabled and are rolled over nightly at midnight. All access log files are created in the following folder:
[install_folder]/logs
25.3.1 Enabling Access Logging for WA
To enable access logging for the WA component itself, edit the following file:
[install_folder]/webapps/scripts/META-INF/context.xml
and/or to enable access logging for the WA archives, edit the following file:
[install_folder]/webapps/archives/META-INF/context.xml
In this file, add a “<Valve>” tag, just before the closing “</Context>” tag, so that the resulting “context.xml” file looks similar to this (the part that you are supposed to add is marked with bold):
<Context caseSensitive="false">
<Manager className="org.apache.catalina.session.StandardManager" pathname=""/>
<Valve prefix="YOURNAME_access_log."
className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" suffix=".log" pattern="common" resolveHosts="false"/>
</Context>
 
In this tag, replace “YOURNAME” with a name that uniquely identifies the context for which you are enabling the logging, for example “WA” or “Archives” (this will become part of the log file name). Lastly, restart LISTSERV Maestro.
25.3.2 Enabling Access Logging for Custom Content
To enable access logging for a given custom content that you have added to Tomcat, do so here:
Copy the following folder (and the files in it) from the “archives” context to your own context (the archives context is automatically installed with each Maestro Tomcat):
[install_folder]/webapps/archives/META-INF/
 
i.e. at the end you should have:
[install_folder]/webapps/YOURCONTEXT/META-INF/
(where “YOURCONTEXT” stands for the name of your context).
 
Now edit the following file:
[install_folder]/webapps/YOURCONTEXT/META-INF/context.xml
 
In this file, either edit the “<Valve>” tag (if one already exists) or add a new one similar to the following (if there is no such tag yet), just before the closing “</Context>” tag, so that the resulting “context.xml” file looks similar to this (the part that you are supposed to add is marked with bold):
<Context caseSensitive="false">
<Manager className="org.apache.catalina.session.StandardManager" pathname=""/>
<Valve prefix="YOURCONTEXT_access_log."
className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" suffix=".log" pattern="common" resolveHosts="false"/>
</Context>
 
In this tag, replace “YOURCONTEXT” with the name of your context (this will become part of the log file name). Lastly, restart LISTSERV Maestro.