tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: 2 simple catalina questions
Date Fri, 10 Aug 2001 00:07:13 GMT


On Thu, 9 Aug 2001, Christopher Cain wrote:

> 
> 1. In server.xml, does an embeded listener take the same form as it does
> in web.xml:
> 
> <Connector ...>
>   <listener>
>     <listener-class>my.package.class</listener-class>
>   </listener>
> </Connector>
> 

No, it follows the style of the other server.xml declarations instead:
* The element name is capitalized.
* The "className" attribute is used to identify which class should be
  instantiated.
* Any other attribute names are matched up against your property setters
  and they are called (with type conversions for Java native types).

So, if your listener has a "setDebug(int debug)" method, you can set the
listener and configure the debug level like this:

  <Connector ...>
    ...
    <Listener className="my.package.class" debug="0"/>
    ...
  </Connector>

An arbitrary number of properties can be set in this way.

> 2. In the above example, should the custom jar containing
> "my.package.class" simply be placed into the {TC_HOME}\server\lib
> directory, or do I need to get it to the startup classloader some other
> way?
> 

Yes, server/lib is the right place if your class is in a JAR
file.  Unpacked classes can be placed in server/classes (which is not
created by default, but is added to the class loader if found).

> Thanks!
> 
> - Christopher
> 

Craig




Mime
View raw message