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.protocol.http; 018 019import java.io.NotSerializableException; 020 021import javax.servlet.http.HttpSession; 022 023import org.apache.wicket.Page; 024import org.apache.wicket.WicketRuntimeException; 025import org.apache.wicket.core.request.handler.IPageProvider; 026 027/** 028 * Thrown when a {@link Page} instance cannot be found by its id in the page stores. The page may be 029 * missing because of reasons like: 030 * <ul> 031 * <li>the page have never been stored there, e.g. an error occurred during the storing process</li> 032 * <li>the http session has expired and thus all pages related to this session are erased too</li> 033 * <li>the page instance has been erased because the store size exceeded</li> 034 * </ul> 035 * 036 * <p>This exception is used to tell Wicket to respond with the configured PageExpiredPage, so its 037 * stacktrace it is not really needed.</p> 038 * 039 * @see HttpSession#setMaxInactiveInterval(int) 040 * @see org.apache.wicket.settings.StoreSettings#setMaxSizePerSession(org.apache.wicket.util.lang.Bytes) 041 * @see NotSerializableException 042 * @see IPageProvider#getPageInstance() 043 */ 044public class PageExpiredException extends WicketRuntimeException 045{ 046 private static final long serialVersionUID = 1L; 047 048 /** 049 * @see WicketRuntimeException#WicketRuntimeException(java.lang.String) 050 */ 051 public PageExpiredException(final String message) 052 { 053 super(message); 054 } 055 056 /** 057 * Constructor 058 * 059 * @param message 060 * @param cause 061 */ 062 public PageExpiredException(final String message, Exception cause) 063 { 064 super(message, cause); 065 } 066 067 /** 068 * Suppress loading of the stacktrace because it is not needed. 069 * 070 * @see java.lang.Throwable#fillInStackTrace() 071 */ 072 @Override 073 public Throwable fillInStackTrace() 074 { 075 // don't do anything here 076 return null; 077 } 078}