Author: rich
Date: Mon Feb 28 21:15:15 2005
New Revision: 155755
URL: http://svn.apache.org/viewcvs?view=rev&rev=155755
Log:
Missed this file in my last checkin.
Added:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/PageFlowExceptionHandler.java
(with props)
Added:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/PageFlowExceptionHandler.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/PageFlowExceptionHandler.java?view=auto&rev=155755
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/PageFlowExceptionHandler.java
(added)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/PageFlowExceptionHandler.java
Mon Feb 28 21:15:15 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.pageflow.internal;
+
+import org.apache.struts.action.ExceptionHandler;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.config.ExceptionConfig;
+import org.apache.struts.util.ModuleException;
+import org.apache.struts.Globals;
+import org.apache.beehive.netui.pageflow.ExpressionMessage;
+import org.apache.beehive.netui.pageflow.config.PageFlowExceptionConfig;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+
+public class PageFlowExceptionHandler
+ extends ExceptionHandler
+{
+ public ActionForward execute( Exception ex, ExceptionConfig ae,
ActionMapping mapping, ActionForm formInstance,
+ HttpServletRequest request,
HttpServletResponse response )
+ throws ServletException
+ {
+ ActionForward forward = null;
+ ActionMessage error = null;
+ String property = null;
+ String path = ae.getPath();
+
+ // Build the forward from the exception mapping if it exists or from
the form input
+ forward = path != null ? new ActionForward( path ) :
mapping.getInputForward();
+
+ // Figure out the error
+ if ( ex instanceof ModuleException )
+ {
+ error = ( ( ModuleException ) ex ).getActionMessage();
+ property = ( ( ModuleException ) ex ).getProperty();
+ }
+ else
+ {
+ if ( ae instanceof PageFlowExceptionConfig )
+ {
+ String expressionMessage = ( ( PageFlowExceptionConfig ) ae
).getDefaultMessage();
+ if ( expressionMessage != null ) error = new
ExpressionMessage( expressionMessage, ex.getMessage() );
+ }
+
+ if ( error == null ) error = new ActionMessage( ae.getKey(),
ex.getMessage() );
+ property = ae.getKey();
+ }
+
+ logException( ex );
+
+ // Store the exception
+ request.setAttribute( Globals.EXCEPTION_KEY, ex );
+ storeException( request, property, error, forward, ae.getScope() );
+
+ return forward;
+ }
+}
Propchange:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/PageFlowExceptionHandler.java
------------------------------------------------------------------------------
svn:eol-style = native