accessing session attributes from Java or XPL

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

accessing session attributes from Java or XPL

Tambet Matiisen
Hi Orbeon!

We need to access session variables set with
xxforms:set-session-variable() from Java or XPL. It's not possible in
XSLT processor, because xxforms:* functions are available only in
XForms. We tried to copy the code from XXFormsGetSessionAttribute.java
and ended up with this:

final StaticExternalContext.StaticContext staticContext =
StaticExternalContext.getStaticContext();
final ExternalContext externalContext = staticContext.getExternalContext();
final ExternalContext.Session session = externalContext.getSession(false);
NodeInfo attributeObject = (NodeInfo)
session.getAttributesMap().get("attribute-name");
System.out.println(attributeObject.getStringValue());

But this code didn't work, the staticContext is returned as null. Does
this code need additional initialization? Is it correct to expect the
attribute be of type NodeInfo, if we store XForms instance in the
attribute? Can we expect that NodeInfo.getStringValue() returns this
XForms instance serialized as text?

Regards
Tambet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws