KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.apache.beehive.netui.util.Bundle;
21 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
22 import org.apache.struts.action.ActionMapping;
23
24 import javax.servlet.http.HttpServletRequest JavaDoc;
25 import javax.servlet.http.HttpServletResponse JavaDoc;
26 import java.io.IOException JavaDoc;
27 import java.io.PrintWriter JavaDoc;
28
29
30 /**
31  * Base class for PageFlow-related Exceptions.
32  */

33 public abstract class PageFlowException
34         extends PageFlowManagedObjectException
35 {
36     private String JavaDoc _actionName;
37     
38     
39     protected PageFlowException( String JavaDoc actionName, FlowController fc )
40     {
41         super( fc );
42         init( actionName );
43     }
44     
45     protected PageFlowException( String JavaDoc actionName, FlowController fc, Throwable JavaDoc cause )
46     {
47         super( fc, cause );
48         init( actionName );
49     }
50     
51     protected void init( String JavaDoc actionName )
52     {
53         _actionName = actionName.startsWith( "/" ) ? actionName.substring( 1 ) : actionName;
54     }
55     
56     /**
57      * Get the related FlowController.
58      *
59      * @return the {@link FlowController} associated with this exception.
60      */

61     public FlowController getFlowController()
62     {
63         return ( FlowController ) getManagedObject();
64     }
65     
66     /**
67      * Get the name of the related FlowController.
68      *
69      * @return the class name of the {@link FlowController} associated with this exception.
70      */

71     public String JavaDoc getFlowControllerURI()
72     {
73         FlowController flowController = getFlowController();
74         return flowController != null ? flowController.getDisplayName() : null;
75     }
76     
77     /**
78      * Get the name of the action associated with this exception.
79      *
80      * @return a String that is the name of the action associated with this exception.
81      */

82     public String JavaDoc getActionName()
83     {
84         return _actionName;
85     }
86     
87     /**
88      * Tell whether the root cause may be session expiration in cases where the requested session ID is different than
89      * the actual session ID; if <code>true</code>, then a {@link SessionExpiredException} will be thrown instead of
90      * this one in these situations.
91      */

92     public abstract boolean causeMayBeSessionExpiration();
93 }
94
Popular Tags