Fórum

session object not carrying forward to flex

Andy Murray, modificado 11 Anos atrás.

session object not carrying forward to flex

New Member Postagens: 11 Data de Entrada: 09/08/12 Postagens Recentes
Hi,

Im trying to embed a Flex .swf file.
Im able to use my user info object in servlets / filters simply by : request.getSession().getAttribute(MyUser.usersession);
where request is of type HttpServletRequest.

But when I invoke a class which is specific to flex and try to get this "MyUser" object from FlexContext's session it is not working.
(MyUser)FlexContext.getHttpRequest().getSession().getAttribute(MyUser.usersession);

Any help much appreciated
Andy Murray, modificado 11 Anos atrás.

RE: session object not carrying forward to flex

New Member Postagens: 11 Data de Entrada: 09/08/12 Postagens Recentes
flex util class is just a normal java class. I have BlazeDs jars in my web-inf.
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: session object not carrying forward to flex

Liferay Legend Postagens: 14915 Data de Entrada: 02/09/06 Postagens Recentes
The web application's session is different than the portlet's session. Portlet session is typically scoped within the ROOT web application's session, and this is a different context.
Andy Murray, modificado 11 Anos atrás.

RE: session object not carrying forward to flex

New Member Postagens: 11 Data de Entrada: 09/08/12 Postagens Recentes
Hey David, thats correct....but there should be some way to get this web application session to portlet session...can u suggest me pls
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: session object not carrying forward to flex

Liferay Legend Postagens: 14915 Data de Entrada: 02/09/06 Postagens Recentes
There isn't a natural way. The portlet request, response, and session objects are, by jsr definition, not assumed to be connected with an application container. Therefore although most jsr implementations run within an application container, since they stick to the jsr definition there is no natural way to get where you're trying to go.

However, if you have a PortletRequest object (either an ActionRequest or a RenderRequest), you can use PortalUtil.getHttpServletRequest() to get to the original HTTP request that started everything off, but this only gets you access to the ROOT HttpSession, and not the session from your own war.

Possibly you could get around this by using a ThreadLocal?