KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > SessionExpiredException


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow;
19
20
21 /**
22  * Exception thrown in place of another {@link PageFlowException} when:
23  * <ul>
24  * <li>The requested session ID is different than the current session ID (or there is no current session), and</li>
25  * <li>the original exception to be thrown returns <code>true</code> for
26  * {@link PageFlowException#causeMayBeSessionExpiration}, and</li>
27  * <li>The <code>&lt;throw-session-expired-exception&gt;</code> element in WEB-INF/beehive-netui-config.xml is
28  * set to <code>true</code> (the default)</li>.
29  * </ul>
30  *
31  * When this exception is thrown, the original exception (considered to be a secondary effect of the session expiration)
32  * can be obtained through {@link #getEffect()}.
33  */

34 public class SessionExpiredException
35         extends PageFlowException
36 {
37     private PageFlowException _effect;
38     
39     public SessionExpiredException( PageFlowException effect )
40     {
41         super( effect.getActionName(), effect.getFlowController() );
42         _effect = effect;
43     }
44
45     protected Object JavaDoc[] getMessageArgs()
46     {
47         return new Object JavaDoc[]{ getActionName(), getFlowControllerURI() };
48     }
49
50     protected String JavaDoc[] getMessageParts()
51     {
52         return new String JavaDoc[]
53         {
54             "Action ", " on page flow ", " cannot be completed because the user session has expired."
55         };
56     }
57     
58     /**
59      * Get the effect of the session expiration; this is the exception that was most likely caused by the session
60      * expiring.
61      */

62     public Throwable JavaDoc getEffect()
63     {
64         return _effect;
65     }
66
67     /**
68      * Tell whether the root cause may be session expiration in cases where the requested session ID is different than
69      * the actual session ID. In this case, the answer is <code>true</code> (since this is the exception that is thrown
70      * in for session expiration).
71      */

72     public boolean causeMayBeSessionExpiration()
73     {
74         return false;
75     }
76 }
77
Popular Tags