Foros de discusión

Flash scope loosing messages during redirect

Robson Miranda, modificado hace 11 años.

Flash scope loosing messages during redirect

New Member Mensajes: 5 Fecha de incorporación: 24/03/11 Mensajes recientes
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, modificado hace 11 años.

RE: Flash scope loosing messages during redirect

New Member Mensajes: 5 Fecha de incorporación: 24/03/11 Mensajes recientes
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, modificado hace 11 años.

RE: Flash scope loosing messages during redirect

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Would you consider this to be a bug in ICEfaces or perhaps in the bridge?
Lee Taylor, modificado hace 11 años.

RE: Flash scope loosing messages during redirect

New Member Mensaje: 1 Fecha de incorporación: 6/08/12 Mensajes recientes
It may be a bug in the Icefaces.
Robson Miranda, modificado hace 11 años.

RE: Flash scope loosing messages during redirect

New Member Mensajes: 5 Fecha de incorporación: 24/03/11 Mensajes recientes
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.

Archivos adjuntos:

thumbnail
Neil Griffin, modificado hace 11 años.

RE: Flash scope loosing messages during redirect

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Is it an ajax-based <redirect /> (portlet ResourceRequest) or does it invoke a full HTTP GET (portlet RenderRequest)?
Robson Miranda, modificado hace 11 años.

RE: Flash scope loosing messages during redirect

New Member Mensajes: 5 Fecha de incorporación: 24/03/11 Mensajes recientes
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, modificado hace 11 años.

RE: Flash scope loosing messages during redirect

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
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, modificado hace 9 años.

RE: Flash scope loosing messages during redirect

New Member Mensajes: 22 Fecha de incorporación: 15/07/13 Mensajes recientes
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, modificado hace 9 años.

RE: Flash scope loosing messages during redirect

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
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, modificado hace 9 años.

RE: Flash scope loosing messages during redirect

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
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, modificado hace 9 años.

RE: Flash scope loosing messages during redirect

New Member Mensajes: 22 Fecha de incorporación: 15/07/13 Mensajes recientes
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