I had attached web.xml with th previous mail. Nevertheless, I am
attaching source code of listener and the web.xml file. 
Grateful if you can spot and informme of errors.

Thanks
ASW
On Tue, 2007-09-04 at 16:38 -0400, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Ashok,
> 
> OFFICIAL WEBSITE wrote:
> > 3. Problem. The listener class does not report sessionCreate and
> > sessionDestroy. It responds perfectly to all other types of event
> > listeners. The servlet class, of course, reports each HttpRequest as
> > they come in.
> 
> Please post your Listener's code and the configuration you use in
> web.xml. "It doesn't work" doesn't make a good post.
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFG3cJQ9CaO5/Lv0PARAkAbAKCTJ2JpDk1yphNZlHaixWUCVcRSjgCcDyDd
> Te1fOL5ZK2/oZpfl61ihAcA=
> =MPiJ
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  Copyright 2004 The Apache Software Foundation

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
    version="2.4">

  <display-name>WEB CVWS</display-name>
  <description>
	  CANDIDATE VERIFICATION WORKFLOW SYSTEM
  </description>
  <servlet>
	  <servlet-name>LoadCandidateJSP</servlet-name>
	  <servlet-class>tcsi.webcvws.services.web.LoadCandidateJSP</servlet-class>
    <init-param>
      <param-name>readonly</param-name>
      <param-value>false</param-value>
    </init-param>

  <load-on-startup>1</load-on-startup>

  <session-config>
    <session-timeout>1</session-timeout>
  </session-config>
  </servlet>

  <!-- The mapping for the CandidateJSP -->
  <!-- Using /* as the mapping ensures that jasper, welcome files etc are
       over-ridden and all requests are processed by the webdav servlet.
       This also overcomes a number of issues with some webdav clients
       (including MS Webfolders) that do not respond correctly
 to the
       redirects (302) that result from using a mapping of / -->
  <servlet-mapping>
    <servlet-name>LoadCandidateJSP</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <!-- ================ Security Constraints for Testing =============== -->

<!--
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>The Entire Web Application</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>tomcat</role-name>
    </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Tomcat Supported Realm</realm-name>
  </login-config>

  <security-role>
    <description>
      An example role defined in "conf/tomcat-users.xml"
    </description>
    <role-name>tomcat</role-name>
  </security-role>
-->
  <welcome-file-list>
    <welcome-file/>
  </welcome-file-list>  

<!--
	Trying out listener with same class
-->
  <listener>
	<listener-class>
	tcsi.webcvws.services.web.CandidateSessionListener
	</listener-class>
  </listener>

</web-app>
/**
 * CandidateSessionListener.java
 *
 *
 * Created: Sun Aug 19 16:24:15 2007
 *
 * @author 
 * @version
 */

/**
 * This class is a listener for sessions originating for candidate JSP, as configures int web.xml
 * It makes a list of sessions that have expired (or null) if none
 * Has a method to return the list to CandidateJSP, which list it then resets to null
 */
package tcsi.webcvws.services.web;

import javax.servlet.*;
import javax.servlet.http.*;

public class CandidateSessionListener implements HttpSessionListener {

    
    private static String expiredList = null;

    public CandidateSessionListener() {
	System.out.println("CandidateSessionListener instantiated");
    }
    public void sessionCreated(HttpSessionEvent hse) {
    }

    public void sessionDestroyed(HttpSessionEvent hse) {
	try {
	    System.out.println("CandidateSessionListener sessionDestroyed called");
	    String sId = hse.getSession().getId();
	    if (expiredList == null)
		expiredList = sId;
	    else
		expiredList = expiredList.concat("," + sId);
	}catch (Exception er) {
	    er.printStackTrace();
	}
    }

    public static String getExpiredList() {
	String s = expiredList;
	expiredList = null;
	return(s);
    }
    
} // CandidateSessionListener

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to