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.core.request.mapper; 018 019import org.apache.wicket.IWicketInternalException; 020import org.apache.wicket.WicketRuntimeException; 021import org.apache.wicket.request.component.IRequestablePage; 022 023/** 024 * Exception invoked when when stale link has been clicked. The page should then be rerendered with 025 * an explanatory error message. 026 * 027 * @author Matej Knopp 028 */ 029public class StalePageException extends WicketRuntimeException implements IWicketInternalException 030{ 031 private static final long serialVersionUID = 1L; 032 033 private final transient IRequestablePage page; 034 035 /** 036 * 037 * Construct. 038 * 039 * @param page 040 */ 041 public StalePageException(IRequestablePage page) 042 { 043 super(String.format("A request to page '%s' has been made with stale 'renderCount'. The page will be re-rendered.", page)); 044 this.page = page; 045 } 046 047 /** 048 * 049 * @return page instance 050 */ 051 public IRequestablePage getPage() 052 { 053 return page; 054 } 055 056 /** 057 * Suppress loading of the stacktrace because it is not needed. 058 * 059 * @see java.lang.Throwable#fillInStackTrace() 060 */ 061 @Override 062 public Throwable fillInStackTrace() 063 { 064 // don't do anything here 065 return null; 066 } 067}