1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts2.jsf;
19
20 import javax.faces.FacesException;
21 import javax.faces.context.FacesContext;
22 import javax.faces.event.PhaseId;
23
24 /***
25 * Updates the model values from the component tree
26 */
27 public class UpdateModelValuesInterceptor extends FacesInterceptor {
28
29 private static final long serialVersionUID = 4011504235094251077L;
30
31 /***
32 * Update Model Values (JSF.2.2.4)
33 *
34 * @param viewId
35 * The view id
36 * @param facesContext
37 * The faces context
38 * @return true, if response is complete
39 */
40 protected boolean executePhase(String viewId, FacesContext facesContext)
41 throws FacesException {
42 boolean skipFurtherProcessing = false;
43 if (log.isTraceEnabled())
44 log.trace("entering updateModelValues");
45
46 informPhaseListenersBefore(facesContext, PhaseId.UPDATE_MODEL_VALUES);
47
48 try {
49 if (isResponseComplete(facesContext, "updateModelValues", true)) {
50
51 return true;
52 }
53 if (shouldRenderResponse(facesContext, "updateModelValues", true)) {
54 skipFurtherProcessing = true;
55 }
56
57 facesContext.getViewRoot().processUpdates(facesContext);
58 } finally {
59 informPhaseListenersAfter(facesContext, PhaseId.UPDATE_MODEL_VALUES);
60 }
61
62 if (isResponseComplete(facesContext, "updateModelValues", false)
63 || shouldRenderResponse(facesContext, "updateModelValues",
64 false)) {
65
66
67 skipFurtherProcessing = true;
68 }
69
70 if (!skipFurtherProcessing && log.isTraceEnabled())
71 log.trace("exiting updateModelValues");
72
73 return skipFurtherProcessing;
74 }
75 }