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 java.io.IOException;
25
26 import javax.faces.FacesException;
27 import javax.faces.application.Application;
28 import javax.faces.application.ViewHandler;
29 import javax.faces.context.FacesContext;
30 import javax.faces.event.PhaseId;
31
32 /***
33 * Performs the JSF render lifecycle phase.
34 *
35 */
36 public class FacesRender extends FacesSupport {
37
38 /***
39 * Executes the render phase, borrowed from MyFaces
40 *
41 * @param facesContext
42 * The faces context
43 * @throws FacesException
44 * If anything goes wrong
45 */
46 public void render(FacesContext facesContext) throws FacesException {
47
48
49 if (isResponseComplete(facesContext, "render", true)) {
50 return;
51 }
52 if (log.isTraceEnabled())
53 log.trace("entering renderResponse");
54
55 informPhaseListenersBefore(facesContext, PhaseId.RENDER_RESPONSE);
56 try {
57
58 if (isResponseComplete(facesContext, "render", true)) {
59 return;
60 }
61 Application application = facesContext.getApplication();
62 ViewHandler viewHandler = application.getViewHandler();
63 try {
64 viewHandler
65 .renderView(facesContext, facesContext.getViewRoot());
66 } catch (IOException e) {
67 throw new FacesException(e.getMessage(), e);
68 }
69 } finally {
70 informPhaseListenersAfter(facesContext, PhaseId.RENDER_RESPONSE);
71 }
72 if (log.isTraceEnabled()) {
73
74
75 }
76
77 if (log.isTraceEnabled())
78 log.trace("exiting renderResponse");
79 }
80 }