掲示板

session object not carrying forward to flex

11年前 に Andy Murray によって更新されました。

session object not carrying forward to flex

New Member 投稿: 11 参加年月日: 12/08/09 最新の投稿
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
11年前 に Andy Murray によって更新されました。

RE: session object not carrying forward to flex

New Member 投稿: 11 参加年月日: 12/08/09 最新の投稿
flex util class is just a normal java class. I have BlazeDs jars in my web-inf.
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: session object not carrying forward to flex

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
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.
11年前 に Andy Murray によって更新されました。

RE: session object not carrying forward to flex

New Member 投稿: 11 参加年月日: 12/08/09 最新の投稿
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
11年前 に David H Nebinger によって更新されました。

RE: session object not carrying forward to flex

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
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?