[Building Sakai] session variables in JSR-168 portlet
csev
csev at umich.edu
Sun Apr 12 07:47:28 PDT 2009
Tobias,
I think that what you want to does not work - but it could be made to
work with some effort.
I think that the key is to look over this document very carefully:
https://source.sakaiproject.org/svn/reference/trunk/docs/architecture/sakai_request.doc
And see if you can get the servlets to "see" the Sakai session instead
of the Tomcat session.
There may be some code changes (I think small) to make things work
since the Sakai request filter has *lots* of seldom-used tricks up its
sleeve.
I will admit that I never dug deeply into this - if you are interested
enough to dig into what works and what does not work and to come up
with a potential solution that includes changes to our portlet support
for sessions, I am happy to help get that back into trunk.
Sakai's portlet supprt is pretty clean (although I have not touchted
it in several years) and Portlet session is backed by Sakai's real
session - so the trick is to get Sakai's real session to back the http
session, I think - the key here is that servlets won't get things like
"current context". since that comes as a side effect of URLs being
forwarded through /portal - not session.
Let us know how it goes.
/Chuck
On Apr 8, 2009, at 6:52 AM, Tobias Schiebeck wrote:
> Hi all,
>
> I'm trying to move a JSR-168 portlet into Sakai-2.5.x . I have the
> problem that I can't find out how to get to the session variables
> which
> are set by the portlet in the servlet that it belongs to.
>
> We currently use in the portlet:
>
> PortletSession portletSession = request.getPortletSession();
> portletSession.setAttribute(namespace + XMLRPC_SERVER_ATTRIBUTE,
> xmlRpcServer,PortletSession.APPLICATION_SCOPE);
>
> in the servlet we try to get the thing back using
>
> xmlRpcServer = getJspContext().getAttribute(
> namespace + PagPortlet.XMLRPC_SERVER_ATTRIBUTE,
> PageContext.SESSION_SCOPE);
>
> unfortunately this returns null rather than the attribute.
>
> looking through the set attributes using:
>
> Enumeration attributes = getJspContext().getAttributeNamesInScope(
> PageContext.SESSION_SCOPE);
> while (attributes.hasMoreElements()) {
> System.err.println(
> " attr: " + attributes.nextElement());
> }
>
> they don't seem to be existent at all.
>
> Is there something we do wrong for sakai as we think this is JSR-168 ?
>
> Thanks for your help
>
> Tobias
>
> --
> ---------------------------------------------------------------------
> Tobias Schiebeck tobias.schiebeck at manchester.ac.uk
> Research Computing Services http://www.rcs.manchester.ac.uk
> The University of Manchester tel: (+44) 161-275-0601
> ---------------------------------------------------------------------
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org
> with a subject of "unsubscribe"
>
>
More information about the sakai-dev
mailing list