div.collapsecontent{display:block;}

Express (Distributed operating systems), v8.0 > Develop and deploying applications > Rapid deployment of J2EE applications > Constructing a J2EE application from artifacts > Dropping J2EE artifacts into a free-form project > Add and deleting Web artifacts from a free-form project


Add and deleting listeners to a free-form project

We can add or delete servlet listener source code, annotated source, or compiled class files for various J2EE listener types related to servlet context and session events and attributes to or from a free-form project.


Before you begin

Restriction: We can use the rapid deployment tools for packaging applications at J2EE 1.3 or 1.4 specification-levels. However, the rapid deployment tools do not support Java EE 5.0 (or later) nor J2EE 1.2 specification-level. For tools support of deploying Java EE 5 and later modules, you can use the monitored directory starting in WAS V8.0 release. For more details about the monitored directory, see Ways to install enterprise applications or modules and Installing enterprise application files by adding them to a monitored directory topics.

Prerequisites

The listener class must be an implementation of the following types:

javax.servlet.ServletContextListener
javax.servlet.ServletContextAttributesListener
javax.servlet.//publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=/  .HttpSessionListener
javax.servlet.//publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=/  .HttpSessionAttributesListener


Procedure

  1. To add listeners to a free-form project, use your file management system to properly place your listener artifacts into the free-form project. The directory name of the free-form project has the same string value you had provided for the -project parameter used in the wrd-config command.
  2. The following activities occur when you drop a listener into the free-form project:

    1. If necessary, the listener class is generated and mapped to the imported_classes directory of the Web module project. The rapid deployment tools then copy the class files to its appropriate J2EE location which is WebContent/WEB-INF/classes folder of the Web module project. The console output can look like this example when adding a listener Java source file (called MyListener.java) to a free-form project (called MyProject):
      [07:58:31 PM] [/MyProject/MyListener.java] Added
      [07:58:31 PM] [/MyProject/bin/MyListener.class] copied to project [MyProjectWeb]
      [07:58:31 PM] Listener added to web.xml: MyListener
      

      Tip: To monitor the rapid deployment activity, run your rapid deployment session with console output. We can complete this by running the rapid deployment launch tool as follows:

      • wrd.bat -monitor
      • wrd.sh -monitor

    2. A new listener entry is created in the Web deployment descriptor (found in the WebContent\WEB-INF\web.xml file in the Web module project). Example of the entries in web.xml:
      <listener>
      <display-name>MyListener
      </display-name>
      <listener-class>MyListener
      </listener-class>
      </listener> 
    3. The application is synchronized with the server.

  3. To delete listeners from a free-form project, use your file management system to properly remove your listener artifacts from the free-form project. The directory name of the free-form project has the same string value you had provided for the -project parameter used in the wrd-config command.
  4. The following activities occur when you remove a listener from the free-form project:

    1. The console output can look like this example when removing a listener Java source file (called MyListener.java) from a free-form project (called MyProject):
      [08:00:23 PM] [/MyProject/MyListener.java] Deleted
      [08:00:23 PM] [/MyProject/bin/MyListener.class] Deleted
      [08:00:23 PM] Listener removed from web.xml: MyListener
      
    2. The application is synchronized with the server.


Feedback

+

Search Tips   |   Advanced Search