flash-scope

Is Flash scope free of race conditions?

核能气质少年 提交于 2019-12-04 12:05:15
问题 I found out that the JSF 2.0 Flash scope is implemented in Mojarra 2.x via a cookie. What seems to happen is that when navigating from view A to view B using The Flash, JSF sends a redirect response. It is this same response that contains the set-cookie header. As cookies are global for the browser, I wonder what the chances are that this leads to a race condition. As the cookie is set during the redirect response, I tried to find if the HTTP spec somehow guarantees that the request that the

Removing JSF messages from the flash

冷暖自知 提交于 2019-11-29 02:05:37
I have one page that does something and when the user clicks a button, the user is redirected to another page and a message is displayed. Here is my code: public String confirm() { FacesContext context = FacesContext.getCurrentInstance(); Flash flash = context.getExternalContext().getFlash(); flash.setKeepMessages(true); FacesMessage msg = new FacesMessage("Succesful", "Release is confirmed!"); context.addMessage(null, msg); return "/prot/expert/releases?faces-redirect=true"; } I use a p:growl component which displays my message on the "releases" page. So far so good. But then on any

Getting warning from JSF: The response was already committed by the time we tried to set the outgoing cookie for the flash

最后都变了- 提交于 2019-11-28 06:30:28
I have a page1.jsf, in this page i have a commandButton that put an object in ELFlash, and redirects to page2.jsf. In this page i recover the object by ELFlash. Everything works fine. But while the user remains in page2.jsf, for every ajax request, tomcat shows this warning message: 20/07/2013 09:43:37 com.sun.faces.context.flash.ELFlash setCookie WARNING: JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash. Any values stored to the flash will not be available on the next request. What does it really mean? Instead of using a Filter as

Removing JSF messages from the flash

一曲冷凌霜 提交于 2019-11-27 21:49:48
问题 I have one page that does something and when the user clicks a button, the user is redirected to another page and a message is displayed. Here is my code: public String confirm() { FacesContext context = FacesContext.getCurrentInstance(); Flash flash = context.getExternalContext().getFlash(); flash.setKeepMessages(true); FacesMessage msg = new FacesMessage("Succesful", "Release is confirmed!"); context.addMessage(null, msg); return "/prot/expert/releases?faces-redirect=true"; } I use a p

How to keep JSF flash scope parameters on page reload?

可紊 提交于 2019-11-27 15:11:11
I use flash scope to pass a setting object between @viewscoped contollers. But if I make a page reload on one of them, then the flash map is empty and the setting object is not initialized. Is it possible to keep flash scope on page reload? My source code to store/retrieve settings: FistPage.xhtml ... <p:commandButton value="next" action="#{firstPageController.transferConfig}" process="@this" /> ... FirstPageController.java @ManagedBean(name = "firstPageController") @ViewScoped public class FirstPageController { ... public String transferConfig() { FacesContext.getCurrentInstance()

Object in Flash scope is not available after redirect

落花浮王杯 提交于 2019-11-27 15:07:25
I have a misunderstanding with the use of flash scope in jsf 2. I want to put an object in flash map during my action and show this object in the next page. Here is my action (call by h:commandLink): public String showDetail(PersonneDTO personne) { MessageFlashBean message = new MessageFlashBean(); message.addMessage("test"); FacesContext.getCurrentInstance().getExternalContext().getFlash() .put("test", message); return "showDetail"; } It's just a test, but the real object I want to use is more complex. Here is the second page with the flash use: <ui:fragment rendered="#{flash.test != null and

How do I retrieve the FacesContext within a Filter

三世轮回 提交于 2019-11-27 09:26:41
How do I retrieve the FacesContext within a Filter? I followed following article on how to retrieve the FacesContext in a Filter : http://ocpsoft.org/java/jsf-java/jsf-20-extension-development-accessing-facescontext-in-a-filter/ But the problem is that it is not working with Flash scope. Following NPE is thrown: java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForWriting(ELFlash.java:751) at com.sun.faces.context.flash.ELFlash.getPhaseMapForWriting(ELFlash.java:785) at com.sun.faces.context.flash.ELFlash.put(ELFlash.java:392) at com.sun.faces.context

Exception about flash in Mojarra JSF

試著忘記壹切 提交于 2019-11-27 08:28:05
I upgraded to Mojarra JSF 2.2.1 (from 2.1.22) and since then for each of my requests I'm having an exception in console: GRAVE: JSF1094: Could not decode flash data from incoming cookie value /?. Processing will continue, but the flash is unavailable for this request. com.sun.faces.lifecycle.InvokeApplicationPhase execute Request finishes succesfully when I'm not using flash scope on it. However, as I'm using this scope for FacesMessages , if I put a message here, I have a NullPointerException and the navigation flow is interrupted: GRAVE: El Servlet.service() para servlet Faces Servlet lanzó

How to keep JSF flash scope parameters on page reload?

时间秒杀一切 提交于 2019-11-26 18:29:34
问题 I use flash scope to pass a setting object between @viewscoped contollers. But if I make a page reload on one of them, then the flash map is empty and the setting object is not initialized. Is it possible to keep flash scope on page reload? My source code to store/retrieve settings: FistPage.xhtml ... <p:commandButton value="next" action="#{firstPageController.transferConfig}" process="@this" /> ... FirstPageController.java @ManagedBean(name = "firstPageController") @ViewScoped public class

Object in Flash scope is not available after redirect

99封情书 提交于 2019-11-26 17:00:42
问题 I have a misunderstanding with the use of flash scope in jsf 2. I want to put an object in flash map during my action and show this object in the next page. Here is my action (call by h:commandLink): public String showDetail(PersonneDTO personne) { MessageFlashBean message = new MessageFlashBean(); message.addMessage("test"); FacesContext.getCurrentInstance().getExternalContext().getFlash() .put("test", message); return "showDetail"; } It's just a test, but the real object I want to use is