1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.portals.bridges.jsf;
17
18 import javax.faces.FacesException;
19 import javax.faces.context.FacesContext;
20 import javax.faces.context.FacesContextFactory;
21 import javax.faces.lifecycle.Lifecycle;
22 import javax.portlet.PortletContext;
23 import javax.portlet.PortletRequest;
24 import javax.portlet.PortletResponse;
25
26 /***
27 * <p>
28 * Loads the {@link PortletFacesContextImpl}
29 * </p>
30 *
31 * @author <a href="dlestrat@apache.org">David Le Strat </a>
32 */
33 public class FacesContextFactoryImpl extends FacesContextFactory
34 {
35 /***
36 * @see javax.faces.context.FacesContextFactory#getFacesContext(java.lang.Object,
37 * java.lang.Object, java.lang.Object, javax.faces.lifecycle.Lifecycle)
38 */
39 public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle)
40 throws FacesException
41 {
42 if (context instanceof PortletContext)
43 {
44 PortletFacesContextImpl facesContext = new PortletFacesContextImpl(
45 (PortletContext) context,
46 (PortletRequest) request,
47 (PortletResponse) response);
48 return facesContext;
49 }
50 else
51 {
52 throw new FacesException("Unsupported context type " + context.getClass().getName());
53 }
54 }
55 }