You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2020/04/21 20:50:57 UTC

[wicket] branch wicket-8.x updated: WICKET-6764 Add constructor to RedirectToUrlException that passes the redirect mode

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch wicket-8.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/wicket-8.x by this push:
     new d00f753  WICKET-6764 Add constructor to RedirectToUrlException that passes the redirect mode
d00f753 is described below

commit d00f7533b601ccee2203e416784387239d161e22
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Tue Apr 21 23:49:40 2020 +0300

    WICKET-6764 Add constructor to RedirectToUrlException that passes the redirect mode
    
    (cherry picked from commit 79f63f66eb588a5d69e9feff7066f1244f61f387)
---
 .../wicket/request/flow/RedirectToUrlException.java      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/wicket-request/src/main/java/org/apache/wicket/request/flow/RedirectToUrlException.java b/wicket-request/src/main/java/org/apache/wicket/request/flow/RedirectToUrlException.java
index 4ca3b8e..537fbdc 100644
--- a/wicket-request/src/main/java/org/apache/wicket/request/flow/RedirectToUrlException.java
+++ b/wicket-request/src/main/java/org/apache/wicket/request/flow/RedirectToUrlException.java
@@ -57,4 +57,20 @@ public class RedirectToUrlException extends ReplaceHandlerException
 	{
 		super(new RedirectRequestHandler(redirectUrl, statusCode), true);
 	}
+
+
+	/**
+	 * Construct.
+	 *
+	 * @param redirectUrl
+	 *            URL to redirect to.
+	 * @param statusCode
+	 *            301 (Moved permanently) or 302 (Moved temporarily)
+	 * @param mode
+	 *            The way to made the redirect - via sendRedirect() or directly via setStatus()+setHeader("Location", ...)
+	 */
+	public RedirectToUrlException(final String redirectUrl, final int statusCode, RedirectRequestHandler.Mode mode)
+	{
+		super(new RedirectRequestHandler(redirectUrl, statusCode).mode(mode), true);
+	}
 }