1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts2.jsf;
22
23 import java.io.IOException;
24
25 import javax.faces.FacesException;
26 import javax.faces.application.Application;
27 import javax.faces.application.ViewHandler;
28 import javax.faces.context.FacesContext;
29 import javax.faces.event.PhaseId;
30
31 /***
32 * Performs the JSF render lifecycle phase.
33 *
34 */
35 public class FacesRender extends FacesSupport {
36
37 /***
38 * Executes the render phase, borrowed from MyFaces
39 *
40 * @param facesContext
41 * The faces context
42 * @throws FacesException
43 * If anything goes wrong
44 */
45 public void render(FacesContext facesContext) throws FacesException {
46
47
48 if (isResponseComplete(facesContext, "render", true)) {
49 return;
50 }
51 if (log.isTraceEnabled())
52 log.trace("entering renderResponse");
53
54 informPhaseListenersBefore(facesContext, PhaseId.RENDER_RESPONSE);
55 try {
56
57 if (isResponseComplete(facesContext, "render", true)) {
58 return;
59 }
60 Application application = facesContext.getApplication();
61 ViewHandler viewHandler = application.getViewHandler();
62 try {
63 viewHandler
64 .renderView(facesContext, facesContext.getViewRoot());
65 } catch (IOException e) {
66 throw new FacesException(e.getMessage(), e);
67 }
68 } finally {
69 informPhaseListenersAfter(facesContext, PhaseId.RENDER_RESPONSE);
70 }
71 if (log.isTraceEnabled()) {
72
73
74 }
75
76 if (log.isTraceEnabled())
77 log.trace("exiting renderResponse");
78 }
79 }