Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
StaleSessionException |
|
| 1.25;1.25 |
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 by an {@link org.apache.tapestry.engine.IEngineService} when |
|
21 | * it discovers that the {@link javax.servlet.http.HttpSession} has timed out |
|
22 | * (and been replaced by a new, empty one). |
|
23 | * <p> |
|
24 | * The application should redirect to the stale-session page. |
|
25 | * |
|
26 | * @author Howard Lewis Ship |
|
27 | */ |
|
28 | ||
29 | public class StaleSessionException extends ApplicationRuntimeException |
|
30 | { |
|
31 | ||
32 | private static final long serialVersionUID = 6733303549871198597L; |
|
33 | ||
34 | private final transient IPage _page; |
|
35 | private final String _pageName; |
|
36 | ||
37 | public StaleSessionException() |
|
38 | { |
|
39 | 1 | this(null, null); |
40 | 1 | } |
41 | ||
42 | public StaleSessionException(String message, IPage page) |
|
43 | { |
|
44 | 3 | super(message, page, null, null); |
45 | 3 | _page = page; |
46 | ||
47 | 3 | if (page != null) _pageName = page.getPageName(); |
48 | 1 | else _pageName = null; |
49 | 3 | } |
50 | ||
51 | public String getPageName() |
|
52 | { |
|
53 | 2 | return _pageName; |
54 | } |
|
55 | ||
56 | /** |
|
57 | * Returns the page referenced by the service URL, if known, or null |
|
58 | * otherwise. |
|
59 | */ |
|
60 | ||
61 | public IPage getPage() |
|
62 | { |
|
63 | 2 | return _page; |
64 | } |
|
65 | } |