RE: Flash scope loosing messages during redirect

Robson Miranda,修改在13 年前。 New Member 帖子: 5 加入日期: 11-3-24 最近的帖子
Hi,

I`m having a problem with the flash scope. If I have a navigation rule with "<redirect/>" defined, the messages stored in flash scope are lost, even though I had set the "keepMessages" flag in the flash object, using LiferayFacesContext.getInstance().getExternalContext().getFlash().setKeepMessages(true) before the redirect.

Is there something that I overlooked? I`m using Liferay 6.1 + LiferayFaces 3.1.0-rc2 + JSF 2.1.3-b02.

Thanks
Robson
Robson Miranda,修改在13 年前。 New Member 帖子: 5 加入日期: 11-3-24 最近的帖子
I sort of solved the problem. It seems that ICEfaces was causing double post (one from AJAX and other normal). I'll try to investigate further.
thumbnail
Neil Griffin,修改在13 年前。 Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
Would you consider this to be a bug in ICEfaces or perhaps in the bridge?
Neil Griffin,修改在13 年前。 New Member 发布: 1 加入日期: 12-8-6 最近的帖子
It may be a bug in the Icefaces.
Robson Miranda,修改在13 年前。 New Member 帖子: 5 加入日期: 11-3-24 最近的帖子
I created a simple application, and the keepMessages works correctly if it is used out of Liferay. So, I think this bug is in the bridge.
thumbnail
Neil Griffin,修改在13 年前。 Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
Is it an ajax-based <redirect /> (portlet ResourceRequest) or does it invoke a full HTTP GET (portlet RenderRequest)?
Robson Miranda,修改在13 年前。 New Member 帖子: 5 加入日期: 11-3-24 最近的帖子
It's a AJAX-based redirect. I tested removing Icefaces JARs and the problem persists. I also tested using "action-url-redirect" setted to true in liferay-portlet.xml, and the messages are also lost.

Thanks.
Robson
thumbnail
Neil Griffin,修改在13 年前。 Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
OK I just created FACES-1386 in order to track this to closure. Please click on the "watch" link in JIRA for further updates. Unfortunately we will have to schedule this to be fixed after the GA1 release, since we're in a QA cycle at this time.
Wojciech Tutro,修改在11 年前。 New Member 帖子: 22 加入日期: 13-7-15 最近的帖子
Hi,

I am developing an application and I need to use flash scope but problem described here still appears. Do You have any workaround or fix for this?
thumbnail
Neil Griffin,修改在11 年前。 Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
Hi Wojciech,

Are you calling FacesContext.getCurrentInstance().getExternalContext().redirect(String) from your JSF backing bean? Or are you using <redirect/> in a navigation-rule? If you are doing it from a backing bean, then please try calling FacesContext.getCurrentInstance().getExternalContext().getFlash().setRedirect(true) first.

Please let us know if that works for you. We are currently investigating whether or not this should be done automatically by Liferay Faces Bridge, or if it should be the responsibility of the application developer.

Kind Regards,

Neil
thumbnail
Neil Griffin,修改在11 年前。 Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
Hi Wojciech,

I did some research and the Mojarra 2.1 NavigationHandlerImpl.java and Mojarra 2.2 NavigationHandlerImpl.java classes correctly call Flash.setRedirect(true) when executing a navigation-rule with <redirect/>.

Although the Mojarra 2.1 version does not call Flash.setKeepMessages(true), the Mojarra 2.2 version will indeed call that method if there is an f:viewAction tag inside of the f:metadata tag.

Kind Regards,

Neil
Wojciech Tutro,修改在11 年前。 New Member 帖子: 22 加入日期: 13-7-15 最近的帖子
Hi Neil,

Sorry for so big delay - I had lot of work last days.
In the mean time I had created some workaround for this issue. My problem was not exactly passing messages from one view to another but passing small object (as I can not use JSF2.2 with FlowScope I decided to "manually" pass the object through few pages). I ended up with bean in session scope.

Best regards,
Wojtek