Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Servlet Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

4.9 Define Listeners

The listener element of a web.xml file defines a listener instance. The listener element contains a listener-class element. Unlike filters or servlets, a listener does not have a name or a mapping. A listener element does not contain initialization parameters.

The listener-class element tells the servlet container how to load the listener. There are two components to this element: the base name of the DLL or shared library that contains the servlet, and the name of the function the container calls to construct the listener. The components of the element are separated by a single period.

The base name of a DLL is the name of the library file without the platform-specific prefix (if any), without the suffix specified on the HydraExpress command line, and without the platform-specific extension. See Appendix C for information on library name mappings for each platform that HydraExpress supports.

The function name in the listener-class element must match the function name defined in the listener implementation. The RWSF_DEFINE_LISTENER macro in the implementation source code defines the function name, as described in Section 6.5.

For example, the web.xml fragment below defines a listener in a DLL named listeners. The servlet container calls the function createTestListener to create the listener.

Since a listener cannot receive initialization parameters, should not allocate resources, and is not mapped to any specific URL, there is no need to create more than one instance of a listener class in the same context. For details on programming a listener, see Section 6.7.



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.