Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
RedirectException |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation |
|
2 | // |
|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 | // you may not use this file except in compliance with the License. |
|
5 | // You may obtain a copy of the License at |
|
6 | // |
|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
|
8 | // |
|
9 | // Unless required by applicable law or agreed to in writing, software |
|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 | // See the License for the specific language governing permissions and |
|
13 | // limitations under the License. |
|
14 | ||
15 | package org.apache.tapestry; |
|
16 | ||
17 | import org.apache.hivemind.ApplicationRuntimeException; |
|
18 | ||
19 | /** |
|
20 | * Exception thrown to force a redirection to an arbitrary location. This is |
|
21 | * used when, after processing a request (such as a form submission or a link |
|
22 | * being clicked), it is desirable to go to some arbitrary new location. |
|
23 | * |
|
24 | * @author Howard Lewis Ship |
|
25 | * @since 1.0.6 |
|
26 | */ |
|
27 | ||
28 | public class RedirectException extends ApplicationRuntimeException |
|
29 | { |
|
30 | ||
31 | private static final long serialVersionUID = -9215837473156146010L; |
|
32 | ||
33 | private final String _redirectLocation; |
|
34 | ||
35 | public RedirectException(String redirectLocation) |
|
36 | { |
|
37 | 3 | this(null, redirectLocation); |
38 | 3 | } |
39 | ||
40 | /** |
|
41 | * @param message |
|
42 | * A message describing why the redirection is taking place. |
|
43 | * @param redirectLocation |
|
44 | * The location to redirect to, may be a relative path (relative |
|
45 | * to the {@link javax.servlet.ServletContext}). |
|
46 | * @see javax.servlet.http.HttpServletResponse#sendRedirect(String) |
|
47 | * @see javax.servlet.http.HttpServletResponse#encodeRedirectURL(String) |
|
48 | */ |
|
49 | ||
50 | public RedirectException(String message, String redirectLocation) |
|
51 | { |
|
52 | 3 | super(message); |
53 | ||
54 | 3 | _redirectLocation = redirectLocation; |
55 | 3 | } |
56 | ||
57 | public String getRedirectLocation() |
|
58 | { |
|
59 | 1 | return _redirectLocation; |
60 | } |
|
61 | } |