1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 package org.apache.myfaces.portlet; 21 22 import javax.portlet.PortletContext; 23 import javax.portlet.PortletException; 24 import javax.portlet.RenderRequest; 25 import javax.portlet.RenderResponse; 26 27 /** 28 * Imlementations of this interface allow a JSF application to specify which 29 * JSF view will be selected when the incoming request does not provide a View 30 * Id. The implementation can optionally return <code>null</code> to revert to 31 * the default View Id specified in portlet.xml. 32 * 33 * @author Stan Silvert (latest modification by $Author: grantsmith $) 34 * @version $Revision: 472618 $ $Date: 2006-11-08 15:06:54 -0500 (Wed, 08 Nov 2006) $ 35 */ 36 public interface DefaultViewSelector { 37 38 /** 39 * This method will be called by the MyFacesGenericPortlet in order to 40 * give the selector an opportunity to store a reference to the 41 * PortletContext. 42 */ 43 public void setPortletContext(PortletContext portletContext); 44 45 /** 46 * This method allows a JSF application to specify which JSF view will be 47 * when the incoming request does not provide a view id. 48 * 49 * @param request The RenderRequest 50 * @param response The RenderResponse 51 * @return a JSF View Id, or <code>null</code> if the selector wishes to 52 * revert to the default View Id specified in portlet.xml. 53 * @throws PortletException if a View Id can not be determined because of 54 * some underlying error. 55 */ 56 public String selectViewId(RenderRequest request, RenderResponse response) throws PortletException; 57 }