01: /*
02: * $Id: FacesContextFactoryImpl.java,v 1.1 2005/06/16 09:13:07 dg154973 Exp $
03: */
04:
05: /*
06: * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
07: * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
08: */
09:
10: package com.sun.faces.portlet;
11:
12: import javax.faces.FacesException;
13: import javax.faces.context.ExternalContext;
14: import javax.faces.context.FacesContext;
15: import javax.faces.context.FacesContextFactory;
16: import javax.faces.lifecycle.Lifecycle;
17:
18: import javax.portlet.PortletContext;
19: import javax.portlet.PortletRequest;
20: import javax.portlet.PortletResponse;
21:
22: import org.apache.commons.logging.Log;
23: import org.apache.commons.logging.LogFactory;
24:
25: /**
26: * <p>Custom implementation of <code>FacesContextFactory</code> that
27: * provides the portlet-specific <code>FacesContext</code> by default.</p>
28: */
29:
30: public final class FacesContextFactoryImpl extends FacesContextFactory {
31:
32: // -------------------------------------------------------- Static Variables
33:
34: // The Log instance for this class
35: private static final Log log = LogFactory
36: .getLog(FacesContextFactoryImpl.class);
37:
38: // --------------------------------------------- FacesContextFactory Methods
39:
40: public FacesContext getFacesContext(Object context, Object request,
41: Object response, Lifecycle lifecycle) throws FacesException {
42: if ((context == null) || (request == null)
43: || (response == null) || (lifecycle == null)) {
44: throw new NullPointerException();
45: }
46:
47: ExternalContext econtext = new ExternalContextImpl(
48: (PortletContext) context, (PortletRequest) request,
49: (PortletResponse) response);
50:
51: return (new FacesContextImpl(econtext, lifecycle));
52:
53: }
54:
55: }
|