It is actually just as easy with 3.3.1.  You create a class the extends
org.apache.tomcat.core.BaseInterceptor, and override the contextInit and
contextShutdown methods.  Alternatively, you could get more fine-grained
context state information by overriding the contextState method.  In the
second case, the state is given by one of the
org.apache.tomcat.core.Context.STATE_* constants. Of course, you can
override any other method, and you will also get notified of those events as
well.  Your class needs to be in a jar file in $TOMCAT_HOME/lib/container,
or as a .class file in $TOMCAT_HOME/lib/container/classes/full/package/name

Once you've created your class, there are several options:
1) You can use the old <RequestInterceptor className="..." > in your
server.xml.  You may also include other attribututes that your class has
setter methods for.  If you want it specific to one context, then you can
include it in your apps-mycontext.xml file instead.
2) You can add an alias to modules.xml and load it server.xml with the
alias. The same context-specific rules apply.
3) You can create an external module.  Follow the pattern for the
PasswardPrompter.war application.  In this case, you install under
$TOMCAT_HOME/modules, instead of $TOMCAT_HOME/lib

The most common reason to add a module to 3.3.1 is to implement a custom
Realm.  In this case, you would normally extend
org.apache.tomcat.modules.aaa.RealmBase.

"Nathan Smith" <[EMAIL PROTECTED]> wrote in message
news:002f01c28151$9ef3b120$7da09384@;nathan...
    I would like to know if it is possible to create a seperated module that
gets loaded when tomcat starts.

I want to be able to use the inner workings of tomcat such as running a
servlet but not from within an application context. I would like to be able
to have this module running autonomously to tomcat but within the tomcat
container.

I have seen that I might have provide some sort of an interceptor, but is
there a particular class that I would extend so that my own class is
loaded by the server classloader, or some other classloader.

I need to probably do the same thing for tomcat 4.1.x and this seems a much
more straight forward task. For this I would extend the class
org.apache.catalina.LifecycleListener and put a <Listener
classname="someclass" /> tag element inside my web application <context/>
element.
This then meens that my own class is notified of when this context is
started and stopped.

It would be really great if there was something similar that I could
implement to use in tomcat 3.3.1.

Any help would be greatly appreciated.


Nathan.



--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@;jakarta.apache.org>





--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to