You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2006/10/12 01:36:23 UTC
svn commit: r463067 -
/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/servlet/AbortWithWebErrorCodeException.java
Author: ehillenius
Date: Wed Oct 11 16:36:22 2006
New Revision: 463067
URL: http://svn.apache.org/viewvc?view=rev&rev=463067
Log:
abort exception with error code and optional message
Added:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/servlet/AbortWithWebErrorCodeException.java
Added: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/servlet/AbortWithWebErrorCodeException.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/servlet/AbortWithWebErrorCodeException.java?view=auto&rev=463067
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/servlet/AbortWithWebErrorCodeException.java (added)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/servlet/AbortWithWebErrorCodeException.java Wed Oct 11 16:36:22 2006
@@ -0,0 +1,64 @@
+/*
+ * $Id: RestartResponseAtInterceptPageException.java,v 1.10 2006/02/13 00:16:32
+ * jonathanlocke Exp $ $Revision: 1.15 $ $Date: 2006/02/13 09:27:16 $
+ *
+ * ==============================================================================
+ * 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.protocol.http.servlet;
+
+import wicket.AbortException;
+import wicket.RequestCycle;
+import wicket.protocol.http.request.WebErrorCodeResponseTarget;
+
+/**
+ * Causes Wicket to abort processing and set the specified HTTP error code, with
+ * the provided message if provided.
+ *
+ * @author Eelco Hillenius
+ *
+ * @see AbortException
+ * @see WebErrorCodeResponseTarget
+ */
+public final class AbortWithWebErrorCodeException extends AbortException
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct.
+ *
+ * @param errorCode
+ * the servlet error code; use one of the
+ * {@link javax.servlet.http.HttpServletResponse} constants
+ * @see javax.servlet.http.HttpServletResponse
+ */
+ public AbortWithWebErrorCodeException(int errorCode)
+ {
+ this(errorCode, null);
+ }
+
+ /**
+ * Construct.
+ *
+ * @param errorCode
+ * the servlet error code; use one of the
+ * {@link javax.servlet.http.HttpServletResponse} constants
+ * @param message
+ * the optional message to send to the client
+ * @see javax.servlet.http.HttpServletResponse
+ */
+ public AbortWithWebErrorCodeException(int errorCode, String message)
+ {
+ RequestCycle.get().setRequestTarget(new WebErrorCodeResponseTarget(errorCode, message));
+ }
+}