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