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…
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
<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?