how to manage sessions in Itmill toolkit based application?

Hi gigs!

I have an application using itmill toolkit framework, and i want to manage sessions as i would in a jsp servlet application. But dont have a clue about how to do it.

Can someone help me out.

I will appreciate for any fast responce

:lol:

vbnet.

You can get the javax.servlet.http.HttpSession from WebApplicationContext.

Just cast current ApplicationContext to WebApplicationContext and get current session from there, example:

        ApplicationContext ctx = getContext();
        WebApplicationContext webCtx = (WebApplicationContext) ctx;
        HttpSession session = webCtx.getHttpSession();

[quote=vbnet]

I have an application using itmill toolkit framework, and i want to manage sessions as i would in a jsp servlet application. But dont have a clue about how to do it./quote]

Toolkit app lives in the same http-session as those JSP:s. So it uses the same session timeout, etc. When the session ends (times out), close() will be called from your application.

You can access the request and then session object directly by registering a transaction listener:
http://toolkit.itmill.com/demo/doc/api/com/itmill/toolkit/service/ApplicationContext.TransactionListener.html#transactionStart(com.itmill.toolkit.Application,%20java.lang.Object)
to applicationcontext (yourapp.getApplicationContext()). Then just cast the transactionData object to HttpServletRequest ja getSession from there.

Thanks guys for your fast responseā€¦i will be working on your suggestions and will post back the results.

thanks again.

vbnet