1919import static com .sun .faces .renderkit .RenderKitUtils .PredefinedPostbackParameter .PARTIAL_EXECUTE_PARAM ;
2020import static com .sun .faces .renderkit .RenderKitUtils .PredefinedPostbackParameter .PARTIAL_RENDER_PARAM ;
2121import static com .sun .faces .renderkit .RenderKitUtils .PredefinedPostbackParameter .PARTIAL_RESET_VALUES_PARAM ;
22+ import static java .util .logging .Level .FINE ;
2223import static javax .faces .FactoryFinder .VISIT_CONTEXT_FACTORY ;
2324
2425import java .io .IOException ;
5657
5758import com .sun .faces .RIConstants ;
5859import com .sun .faces .component .visit .PartialVisitContext ;
59- import com .sun .faces .context .flash .ELFlash ;
6060import com .sun .faces .renderkit .RenderKitUtils .PredefinedPostbackParameter ;
6161import com .sun .faces .util .FacesLogger ;
6262import com .sun .faces .util .HtmlUtils ;
@@ -308,6 +308,7 @@ public void processPartial(PhaseId phaseId) {
308308 if (isRenderAll ()) {
309309 renderAll (ctx , viewRoot );
310310 renderState (ctx );
311+ doFlashPostPhaseActions (ctx );
311312 writer .endDocument ();
312313 return ;
313314 }
@@ -322,10 +323,9 @@ public void processPartial(PhaseId phaseId) {
322323
323324 renderState (ctx );
324325 renderEvalScripts (ctx );
326+ doFlashPostPhaseActions (ctx );
325327
326- if (!ctx .getAttributes ().containsKey (ELFlash .DELAYED_END_DOCUMENT ) || !(Boolean ) ctx .getAttributes ().get (ELFlash .DELAYED_END_DOCUMENT )) {
327- writer .endDocument ();
328- }
328+ writer .endDocument ();
329329 } catch (IOException ex ) {
330330 this .cleanupAfterView ();
331331 } catch (RuntimeException ex ) {
@@ -335,6 +335,16 @@ public void processPartial(PhaseId phaseId) {
335335 }
336336 }
337337 }
338+
339+ private void doFlashPostPhaseActions (FacesContext ctx ) {
340+ try {
341+ ctx .getExternalContext ().getFlash ().doPostPhaseActions (ctx );
342+ } catch (UnsupportedOperationException uoe ) {
343+ if (LOGGER .isLoggable (FINE )) {
344+ LOGGER .fine ("ExternalContext.getFlash() throw UnsupportedOperationException -> Flash unavailable" );
345+ }
346+ }
347+ }
338348
339349 /**
340350 * @see javax.faces.context.PartialViewContext#getPartialResponseWriter()
0 commit comments