Problems Implementing an HttpSessionListener

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

Problems Implementing an HttpSessionListener

Postby sbutler » Thu Dec 17, 2009 6:08 pm

So I'm working on a custom webservice and I'm having a problem with my Servlet always starting a new headless client session. I'm passing in ":jsessionid=..." in the url but the servlet is still unable to retrieve the session. (FYI, the request to the service is being done over a JSONP request with jQuery). So, I decided to implement an HttpSessionListener to keep a Map of the sessions so I could manually retrieve the HttpSession based on the jessionid, and then I can get the ISessionBean from the HttpSession. However, the HttpSessionListener doesn't seem to be working. I've created something like...

Code: Select all
package com.itechprofessionals.plugins.webservices;
public class SessionListener implements HttpSessionListener{
   
   Map itechsessions = new HashMap();
   ServletContext sc = null

   public void sessionCreated(HttpSessionEvent hse) {
      ...
   }

   public void sessionDestroyed(HttpSessionEvent hse) {
      ...
   }

}


And I added this to the web.xml in application_server/server/webapps/ROOT/WEB-INF
Code: Select all
   <listener>
      <listener-class>com.itechprofessionals.plugins.webservices.SessionListener</listener-class>
   </listener>


My servlet is created from the server plugin with something like IServerAccess.registerWebService("iTechWebService", new ServletService());
However My SessionListener doesn't seem to be listening to requests on the ServletService. Any ideas?
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Problems Implementing an HttpSessionListener

Postby patrick » Thu Dec 17, 2009 6:33 pm

if you keep a reference to the HttpSession in your server plugin and reuse that, it does start a new headless instance? I had to call removeAttribute() to actually kill the headless client...
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 8 guests