User Guide

To make use of this library you must run at least Java context.get("maven.compiler.target").

Notice
These components have been tested with Apache Tomcat 8.5.x only.

This site will guide you through the components of this library:

  1. CloseableResourceListener: Prevents memory leaks caused by left open resources during undeployment. (discontinued)
  2. LogbackContextNameListener: Makes Logback aware of a webapp's context name. (superseded)
  3. ContextNamingInfoListener: Provides you all necessary context naming information via JNDI environment entries.
  4. EnhancedErrorReportValve: An alternative error report valve with several improvements over the original one. (discontinued)
  5. PropertiesRoleMappingListener: Provides a mapping from technical roles to application roles from a properties file.

Before using this library, make sure that the artifact is in the class path of your Tomcat instance, i.e., in $CATALINA_BASE/lib or $CATALINA_HOME/lib.

CloseableResourceListener

This listener is obsolete now since Tomcat includes a close handler from version 7. See here for details on closeMehod.

LogbackContextNameListener

This listener has been superseded by the ContextNamingInfoListener.

ContextNamingInfoListener

Ever needed your context path, name, version, etc. to be available to your application or your Spring context?

Open your app's context.xml and add:

<Context>
[…]
  <!-- Add this -->
  <Listener className="net.sf.michaelo.tomcat.extras.listeners.ContextNamingInfoListener" />
[…]
</Context>

It will automagically add your context naming information as environment entries to your webapp's JNDI initial context. For more details see the here.

EnhancedErrorReportValve

This valve is obsolete now since Tomcat does include all modifications in the bundled valve. See Bugzilla issue for details.

PropertiesRoleMappingListener

Consider you cannot change the role names from your company's role store but would like to use readable role names in your app. This can be achieved with a proper mapping performed by this listener. For more details see the here.

To make use of this listener you must declare it in your application. Open your app's context.xml and add:

<Context>
[…]
  <!-- Add this -->
  <Listener className="net.sf.michaelo.tomcat.extras.listeners.PropertiesRoleMappingListener" />
  <!-- Followed by your realm -->
  <!-- <Realm … /> -->
[…]
</Context>

now add the appropriate role mapping file to WEB-INF/role-mapping.properties:

id-xyz = User
id-abc = Manager
id-foo = Admin

Make sure that your realm implementation actually queries the populated mapping and then you can user the new application roles in your web.xml and with request#isUserInRole().