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