001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.request.component; 018 019import org.apache.wicket.page.IManageablePage; 020import org.apache.wicket.request.mapper.parameter.PageParameters; 021 022 023/** 024 * Base interface for pages. The purpose of this interface is to make certain parts of Wicket easier 025 * to mock and unit test. 026 * 027 * @author Matej Knopp 028 * @author Igor Vaynberg (ivaynberg) 029 */ 030public interface IRequestablePage extends IRequestableComponent, IManageablePage 031{ 032 /** 033 * Renders the page 034 */ 035 void renderPage(); 036 037 /** 038 * Bookmarkable page can be instantiated using a bookmarkable URL. 039 * 040 * @return Returns true if the page is bookmarkable. 041 */ 042 boolean isBookmarkable(); 043 044 /** 045 * Returns the number of times this page has been rendered. The number will be appended to 046 * request listener links in order to prevent invoking listeners from staled page version. 047 * <p> 048 * For example, the same page might have been rendered in two separate tabs. Page render doesn't 049 * change page id, but it can modify component hierarchy. Request listeners on such page 050 * should only work in tab where the page was rendered most recently. 051 * 052 * @return render count 053 */ 054 int getRenderCount(); 055 056 /** 057 * Returns whether the page instance was created by a bookmarkable URL. Non mounted pages have 058 * to be created using bookmarkable URL in order to have hybrid URLs later. Otherwise it would 059 * be a potential security risk. 060 * 061 * @return <code>true</code> if this page has been created by a bookmarkable URL, 062 * <code>false</code> otherwise. 063 */ 064 boolean wasCreatedBookmarkable(); 065 066 /** 067 * Returns the {@link PageParameters} for the page. Each bookmarkable page instance should have 068 * {@link PageParameters} associated with it. The page parameters are initialized from URL when 069 * page is created and are updated on every page render request. 070 * 071 * @return page parameters or <code>null</code> 072 */ 073 PageParameters getPageParameters(); 074}