001 // Copyright 2006, 2007, 2008, 2009, 2011 The Apache Software Foundation002 //003 // Licensed under the Apache License, Version 2.0 (the "License");004 // you may not use this file except in compliance with the License.005 // You may obtain a copy of the License at006 //007 // http://www.apache.org/licenses/LICENSE-2.0008 //009 // Unless required by applicable law or agreed to in writing, software010 // distributed under the License is distributed on an "AS IS" BASIS,011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.012 // See the License for the specific language governing permissions and013 // limitations under the License.014015 package org.apache.tapestry5.internal.services;016017 import org.apache.tapestry5.internal.structure.Page;018 import org.apache.tapestry5.runtime.PageLifecycleListener;019020 /**021 * Per-thread service that caches page instances for the duration of the request, and is also responsible for tracking022 * the active page (the page which will ultimately render the response).023 * <p/>024 * Since {@link org.apache.tapestry5.internal.structure.Page} is internal, most user-code should use the025 * {@link org.apache.tapestry5.services.ComponentSource} service instead.026 * <p>027 * Starting in 5.2, page instances are shared (with externalized mutable state), not pooled, but the cache is still028 * useful for managing the page's {@linkplain PageLifecycleListener lifecycle}.029 */030 public interface RequestPageCache031 {032 /**033 * Gets the page via its page name, in the current locale. The logical page name is resolved to a class name, which034 * is used to obtain the page (from the page pool). Note that under certain circumstances, a page may have multiple035 * names (even beyond simple case-insensitivity), and RequestPageCache caches correctly.036 * 037 * @param pageName038 * the name of the page to retrieve (this is the logical page name, not the fully qualified class039 * name)040 * @return a page instance reserved for this request041 * @throws IllegalArgumentException042 * if the name can not be resolved to a page instance043 */044 Page get(String pageName);045 }