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!