/*
 * $Id: RestartResponseAtInterceptPageException.java,v 1.10 2006/02/13 00:16:32
 * jonathanlocke Exp $ $Revision$ $Date$
 * 
 * ==============================================================================
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package wicket;

/**
 * Causes Wicket to interrupt current request processing and immediately
 * redirect to an intercept page.
 * <p>
 * Similar to calling redirectToInteceptPage(Page) with the difference that this
 * exception will interrupt processing of the current request.
 * 
 * @see wicket.PageMap#redirectToInterceptPage(Page)
 * @see wicket.Component#redirectToInterceptPage(Page)
 * 
 * @author Igor Vaynberg (ivaynberg)
 * @author Jonathan Locke
 */
public class RestartResponseAtInterceptPageException extends AbstractRestartResponseException
{
	private static final long serialVersionUID = 1L;

	/**
	 * Redirects to the specified intercept page
	 * 
	 * @param interceptPage
	 *            redirect page
	 */
	public RestartResponseAtInterceptPageException(final Page interceptPage)
	{
		if (interceptPage == null)
		{
			throw new IllegalStateException("Argument interceptPage cannot be null");
		}

		redirectToInterceptPage(interceptPage);
	}

	/**
	 * Redirects to the specified intercept page
	 * 
	 * @param interceptPageClass
	 *            Class of intercept page to instantiate
	 */
	public RestartResponseAtInterceptPageException(final Class interceptPageClass)
	{
		if (interceptPageClass == null)
		{
			throw new IllegalStateException("Argument pageClass cannot be null");
		}
		redirectToInterceptPage(Session.get().getPageFactory().newPage(interceptPageClass));
	}

	/**
	 * Redirects to intercept page using the page map for the current request
	 * 
	 * @param interceptPage
	 *            The intercept page to redirect to
	 */
	private void redirectToInterceptPage(final Page interceptPage)
	{
		RequestCycle.get().getRequest().getPage().getPageMap().redirectToInterceptPage(
				interceptPage);
	}
}

@@ -1218,16 +1218,42 @@
 n Locke%0A
+ * @author Philip Chapman%0A
  */%0Apubl
@@ -2415,16 +2415,25 @@
 e)%0A%09%7B%0A%09%09
+Page p = 
 RequestC
@@ -2465,16 +2465,267 @@
 etPage()
+;%0A%09%09/*%0A%09%09 * page can be null if we throw the restart response exception before%0A%09%09 * any page is instantiated in user's session. if this happens we switch%0A%09%09 * to the pagemap of the interceptPage%0A%09%09 */%0A%09%09if (p == null)%0A%09%09%7B%0A%09%09%09p = interceptPage;%0A%09%09%7D%0A%09%09p
 .getPage
@@ -2758,13 +2758,8 @@
 age(
-%0A%09%09%09%09
 inte

fix by pchapman