Sorry Etienne. That was a copy-paste error. I pasted the stmt in the wrong method i.e. ctr instead of handlerequest.
Thanks and regards, Janak >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] Behalf Of Etienne Studer >Sent: Tuesday, October 24, 2006 10:59 PM >To: [email protected] >Subject: RE: [ULC-developer] >ServletContainerContext.getHttpSession().invalidate() > > >Hi Janak > >Thanks for the code and the quick reply. I had to modify the code a >little bit to make it work (see below), mainly moving the invalidate() >call to the handleRequestContent() method, but now it works fine. > >Thanks and regards, Etienne > >public class ULCCarinaServletContainerAdapter extends >ServletContainerAdapter { > public void init() throws ServletException { > _helper = new >CarinaServletContainerAdapterHelper(getServletConfig()); > } > > protected void service(HttpServletRequest inRequest, >HttpServletResponse inResponse) throws ServletException, IOException { > if (!_helper.service(inRequest, inResponse, getServletConfig())) >{ > super.service(inRequest, inResponse); > } > } > > public class CarinaServletContainerAdapterHelper extends >ServletContainerAdapterHelper { > public CarinaServletContainerAdapterHelper(ServletConfig >inServletConfig) { > super(inServletConfig); > } > > protected ContainerCommand createStopCommand() throws >ServletException { > return new CarinaRemoveSessionCommand(this); > } > } > > public class CarinaRemoveSessionCommand extends RemoveSessionCommand >{ > public CarinaRemoveSessionCommand(ICommandInfo inCommandInfo) { > super(inCommandInfo); > } > > protected void handleRequestContent(IObjectInputStream inStream) >throws ServletException, IOException { > super.handleRequestContent(inStream); > ServletContainerContext.getHttpSession().invalidate(); > } > } > > private ServletContainerAdapterHelper _helper; >} > > > > > > >-----Original Message----- >From: Janak Mulani [mailto:[EMAIL PROTECTED] >Sent: Sunday, October 22, 2006 11:21 AM >To: Etienne Studer >Cc: [email protected] >Subject: RE: [ULC-developer] >ServletContainerContext.getHttpSession().invalidate() > >Hi Etienne > >There is already an issue: https://www.canoo.com/jira/browse/UBA-807. > >It is not safe to invalidate the session at the application level in >IApplication#stop(). Even after the stop request, there is still some >protocol left at the connector level. > >So, to invalidate the session you will need to extend >ServletContainerAdapterHelper: > >public class YourServletContainerAdapter extends HttpServlet { > private YourServletContainerAdapterHelper fHelper; > > public void init() throws ServletException { > fHelper = new >YourServletContainerAdapterHelper(getServletConfig()); > } > > protected void service(HttpServletRequest request, >HttpServletResponse >response) throws ServletException, IOException { > if (!fHelper.service(request, response, getServletConfig())) { > super.service(request, response); > } > } >} > > >public class YourServletContainerAdapterHelper extends >ServletContainerAdapterHelper { > protected ContainerCommand createStopCommand() throws ServletException >{ > return new YourRemoveSessionCommand(this); > } >} > >public class YourRemoveSessionCommand extends RemoveSessionCommand { > public YourRemoveSessionCommand(ICommandInfo commandInfo) { > super(commandInfo); >>>>>>> ServletContainerContext.getHttpSession().invalidate(); > } > > protected void handleRequestContent(IObjectInputStream in) throws >ServletException, IOException { > super.handleRequestContent(in); > } >} > >I hope this helps. > >Thanks and regards, > >Janak > > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] Behalf Of Etienne Studer >Sent: Friday, October 20, 2006 4:46 AM >To: [email protected] >Subject: [ULC-developer] >ServletContainerContext.getHttpSession().invalidate() > > >Hi ULC Team > >Is it safe to call ServletContainerContext.getHttpSession().invalidate() >within IApplication#stop()? > >Thanks, Etienne > >_______________________________________________ >ULC-developer mailing list >[email protected] >http://lists.canoo.com/mailman/listinfo/ulc-developer _______________________________________________ ULC-developer mailing list [email protected] http://lists.canoo.com/mailman/listinfo/ulc-developer
