1 /*2 * Copyright 2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16 package org.apache.myfaces.context;17 18 import org.apache.myfaces.context.servlet.ServletFacesContextImpl;19 20 import javax.faces.FacesException;21 import javax.faces.context.FacesContext;22 import javax.faces.context.FacesContextFactory;23 import javax.faces.lifecycle.Lifecycle;24 import javax.portlet.PortletContext;25 import javax.portlet.PortletRequest;26 import javax.portlet.PortletResponse;27 import javax.servlet.ServletContext ;28 import javax.servlet.ServletRequest ;29 import javax.servlet.ServletResponse ;30 31 /**32 * DOCUMENT ME!33 * @author Manfred Geiler (latest modification by $Author: matzew $)34 * @version $Revision: 1.12 $ $Date: 2005/01/26 17:03:10 $35 */36 public class FacesContextFactoryImpl37 extends FacesContextFactory38 {39 public FacesContext getFacesContext(Object context,40 Object request,41 Object response,42 Lifecycle lifecycle)43 throws FacesException44 {45 if (context instanceof ServletContext )46 {47 return new ServletFacesContextImpl((ServletContext )context,48 (ServletRequest )request,49 (ServletResponse )response);50 }51 52 if (context instanceof PortletContext)53 {54 return new ServletFacesContextImpl((PortletContext)context,55 (PortletRequest)request,56 (PortletResponse)response);57 }58 59 throw new FacesException("Unsupported context type " + context.getClass().getName());60 }61 }62