Welcome, Guest
Please Login or Register.    Lost Password?

How to store and retrieve application level data?
(1 viewing) (1) Guest
Convertigo Products
This is the place to ask questions, request for enhancements and more generally discuss about Convertigo products.
Go to bottomPage: 1
TOPIC: How to store and retrieve application level data?
#143
How to store and retrieve application level data? 1 Year, 1 Month ago Karma: 0
If you want to store and retrieve application level data in C8O, i.e. data you can share amongst all C8O contexts, you can simply use the httpSession object of the context.
In a SimpleStatement, you can use the following code:
Code:

var servletContext = context.httpSession.getServletContext();
servletContext.setAttribute("mykey", "myvalue");


and reuse your key in another SimpleStatement:
Code:

var servletContext = context.httpSession.getServletContext();
var myvalue = servletContext.getAttribute("mykey");


That's it!

Do not forget that these data will be available for all projects of the C8O server!
fabienb
Moderator
Posts: 16
graphgraph
User Offline Click here to see the profile of this user
Convertigo Location: Paris
Last Edit: 2011/04/12 15:47 By fabienb.
Fabien Balageas
Convertigo - CTO
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: elodiee