<!-- localXsltFile Make directory listings an XML doc and -->
<!-- pass the result to this style sheet residing -->
<!-- in that directory. This overrides -->
- <!-- globalXsltFile[null] -->
+ <!-- contextXsltFile and globalXsltFile[null] -->
+ <!-- -->
+ <!-- contextXsltFile Make directory listings an XML doc and -->
+ <!-- pass the result to this style sheet which is -->
+ <!-- relative to the context root. This overrides -->
+ <!-- globalXsltFile[null] -->
<!-- -->
<!-- globalXsltFile Site wide configuration version of -->
<!-- localXsltFile This argument is expected -->
/**
* Allow customized directory listing per directory.
*/
- protected String localXsltFile = null;
+ protected String localXsltFile = null;
/**
+ * Allow customized directory listing per context.
+ */
+ protected String contextXsltFile = null;
+
+
+ /**
* Allow customized directory listing per instance.
*/
- protected String globalXsltFile = null;
+ protected String globalXsltFile = null;
/**
fileEncoding = getServletConfig().getInitParameter("fileEncoding");
globalXsltFile = getServletConfig().getInitParameter("globalXsltFile");
+ contextXsltFile = getServletConfig().getInitParameter("contextXsltFile");
localXsltFile = getServletConfig().getInitParameter("localXsltFile");
readmeFile = getServletConfig().getInitParameter("readmeFile");
trimmed.equalsIgnoreCase(localXsltFile))
continue;
+ if ((cacheEntry.name + trimmed).equals(contextXsltFile))
+ continue;
+
CacheEntry childCacheEntry =
resources.lookupCache(cacheEntry.name + resourceName);
if (!childCacheEntry.exists) {
} catch (NamingException e) {
if (debug > 10)
log("localXsltFile '" + localXsltFile + "' not found", e);
-
- return null;
}
}
+ if (contextXsltFile != null) {
+ InputStream is =
+ getServletContext().getResourceAsStream(contextXsltFile);
+ if (is != null)
+ return is;
+
+ if (debug > 10)
+ log("contextXsltFile '" + contextXsltFile + "' not found");
+ }
+
/* Open and read in file in one fell swoop to reduce chance
* chance of leaving handle open.
*/
If you wish to customize your directory listing, you
can use an XSL transformation. This value is an absolute
file name which be used for all directory listings.
- This can be disabled by per webapp by also declaring the
- default servlet in your local webapp's web.xml. The format
- of the xml is shown below.
+ This can be overridden per context and/or per directory. See
+ <strong>contextXsltFile</strong> and <strong>localXsltFile</strong>
+ below. The format of the xml is shown below.
+ </td>
+ </tr>
+ <tr>
+ <th valign='top'>contextXsltFile</th>
+ <td valign='top'>
+ You may also customize your directory listing by context by
+ configuring <code>contextXsltFile</code>. This should be a context
+ relative path (e.g.: <code>/path/to/context.xslt</code>). This
+ overrides <code>globalXsltFile</code>. If this value is present but a
+ file does not exist, then <code>globalXsltFile</code> will be used. If
+ <code>globalXsltFile</code> does not exist, then the default
+ directory listing will be shown.
</td>
</tr>
<tr>
You may also customize your directory listing by directory by
configuring <code>localXsltFile</code>. This should be a relative
file name in the directory where the listing will take place.
- This overrides <code>globalXsltFile</code>. If this value
- is present but a file does not exist, then
+ This overrides <code>globalXsltFile</code> and
+ <code>contextXsltFile</code>. If this value is present but a file
+ does not exist, then <code>contextXsltFile</code> will be used. If
+ <code>contextXsltFile</code> does not exist, then
<code>globalXsltFile</code> will be used. If
<code>globalXsltFile</code> does not exist, then the default
directory listing will be shown.