01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * $Header:$
18: */
19: package org.apache.beehive.netui.pageflow;
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><throw-session-expired-exception></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 extends PageFlowException {
35: private PageFlowException _effect;
36:
37: public SessionExpiredException(PageFlowException effect) {
38: super (effect.getActionName(), effect.getFlowController());
39: _effect = effect;
40: }
41:
42: protected Object[] getMessageArgs() {
43: return new Object[] { getActionName(), getFlowControllerURI() };
44: }
45:
46: protected String[] getMessageParts() {
47: return new String[] { "Action ", " on page flow ",
48: " cannot be completed because the user session has expired." };
49: }
50:
51: /**
52: * Get the effect of the session expiration; this is the exception that was most likely caused by the session
53: * expiring.
54: */
55: public Throwable getEffect() {
56: return _effect;
57: }
58:
59: /**
60: * Tell whether the root cause may be session expiration in cases where the requested session ID is different than
61: * the actual session ID. In this case, the answer is <code>true</code> (since this is the exception that is thrown
62: * in for session expiration).
63: */
64: public boolean causeMayBeSessionExpiration() {
65: return false;
66: }
67: }
|