You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shale.apache.org by cr...@apache.org on 2006/08/07 09:18:26 UTC
svn commit: r429262 - in /shale/framework/trunk:
shale-apps/shale-usecases/src/main/java/org/apache/shale/usecases/exception/
shale-apps/shale-usecases/src/main/resources/org/apache/shale/usecases/view/
shale-apps/shale-usecases/src/main/webapp/ shale-...
Author: craigmcc
Date: Mon Aug 7 00:18:25 2006
New Revision: 429262
URL: http://svn.apache.org/viewvc?rev=429262&view=rev
Log:
Update the exception handler lookups to be more efficient, and add a
system integration test case that works (although a level of unwrapping
FacesException is proboably warranted for usability). Leave the JIRA
issue open until the test case (and possibly others) have been
automated.
SHALE-125
Added:
shale/framework/trunk/shale-apps/shale-usecases/src/main/java/org/apache/shale/usecases/exception/
shale/framework/trunk/shale-apps/shale-usecases/src/main/java/org/apache/shale/usecases/exception/Test.java
shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/
shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/correct.jsp
shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/incorrect.jsp
shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/test.jsp
Modified:
shale/framework/trunk/shale-apps/shale-usecases/src/main/resources/org/apache/shale/usecases/view/Bundle.properties
shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/faces-config.xml
shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/web.xml
shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/token/test.jsp
shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/usecases.jsp
shale/framework/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java
shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/LifecycleListener.java
shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewActionListener.java
shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewControllerCallbacks.java
shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewPhaseListener.java
shale/framework/trunk/shale-core/src/main/resources/META-INF/faces-config.xml
shale/framework/trunk/shale-tiger/src/main/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java
Added: shale/framework/trunk/shale-apps/shale-usecases/src/main/java/org/apache/shale/usecases/exception/Test.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/java/org/apache/shale/usecases/exception/Test.java?rev=429262&view=auto
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/java/org/apache/shale/usecases/exception/Test.java (added)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/java/org/apache/shale/usecases/exception/Test.java Mon Aug 7 00:18:25 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 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 languamount governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shale.usecases.exception;
+
+import org.apache.shale.view.AbstractViewController;
+
+/**
+ * <p>Backing bean for the exception use case.</p>
+ *
+ * $Id: Test.java 410891 2006-06-01 17:04:20Z craigmcc $
+ */
+public class Test extends AbstractViewController {
+
+
+ /**
+ * <p>Throw an exception and then attempt to navigate to
+ * the "incorrect" page.</p>
+ */
+ public String submit() {
+ int i = 1;
+ int j = 0;
+ int k = i / j;
+ return "exception$incorrect";
+ }
+
+
+}
Modified: shale/framework/trunk/shale-apps/shale-usecases/src/main/resources/org/apache/shale/usecases/view/Bundle.properties
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/resources/org/apache/shale/usecases/view/Bundle.properties?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/resources/org/apache/shale/usecases/view/Bundle.properties (original)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/resources/org/apache/shale/usecases/view/Bundle.properties Mon Aug 7 00:18:25 2006
@@ -35,6 +35,18 @@
ajax.zip.zipPrompt=Zip
ajax.pick=pick one
+# Exception Handling Tests
+exception.correct.exception_type=Exception Type:
+exception.correct.message=Exception Message:
+exception.correct.request_uri=Exception Request URI:
+exception.correct.status_code=HTTP Status Code:
+exception.correct.title=Exception Handling - Correct Result
+exception.incorrect.message=Unfortunately, navigation to the originally configured page occurred. The exception was not supposed to be ignored.
+exception.incorrect.title=Exception Handling - Incorrect Result
+exception.test.description=Test whether an application exception is redirected to the configured display page.
+exception.test.message=The action handler for this submit will throw an exception that should be directed to a page showing the exception details.
+exception.test.title=Exception Handling Test
+
# JNDI Test Labels
jndi.test.title=JNDI Test Title
jndi.test.expected=Expected:
@@ -124,6 +136,8 @@
usecases.ajax=Ajax Examples
usecases.completion=Code Completion (Standard JSF Components)
usecases.edit=Edit User Profile
+usecases.exceptiontest=Test Exception Handling
+usecases.exceptiontests=Exception Handling Tests
usecases.java=Old-Style Remoting Support (Java Based)
usecases.jndi=JNDI Access Via Expressions
usecases.jsp=Old-Style Remoting Support (JSP Based)
Modified: shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/faces-config.xml?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/faces-config.xml Mon Aug 7 00:18:25 2006
@@ -112,6 +112,54 @@
</navigation-rule>
+ <!-- ================= EXCEPTION HANDLER Test ============================ -->
+
+
+ <!-- ViewController Beans -->
+
+ <managed-bean>
+ <managed-bean-name>exception$test</managed-bean-name>
+ <managed-bean-class>
+ org.apache.shale.usecases.exception.Test
+ </managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+<!--
+ <managed-bean>
+ <managed-bean-name>exception$correct</managed-bean-name>
+ <managed-bean-class>
+ org.apache.shale.usecases.exception.Correct
+ </managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>exception$incorrect</managed-bean-name>
+ <managed-bean-class>
+ org.apache.shale.usecases.exception.Incorrect
+ </managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+-->
+
+
+ <!-- Navigation Rules -->
+
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>exception$test</from-outcome>
+ <to-view-id>/exception/test.jsp</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>exception$incorrect</from-outcome>
+ <to-view-id>/exception/incorrect.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+
<!-- ============================== JNDI Test ============================ -->
Modified: shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/web.xml?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/web.xml (original)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/WEB-INF/web.xml Mon Aug 7 00:18:25 2006
@@ -45,7 +45,11 @@
</context-param>
<!-- Shale Application Controller Filter -->
- <filter>
+ <context-param>
+ <param-name>org.apache.shale.view.EXCEPTION_DISPATCH_PATH</param-name>
+ <param-value>/exception/correct.faces</param-value>
+ </context-param>
+ <filter>
<filter-name>shale</filter-name>
<filter-class>
org.apache.shale.faces.ShaleApplicationFilter
Added: shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/correct.jsp
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/correct.jsp?rev=429262&view=auto
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/correct.jsp (added)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/correct.jsp Mon Aug 7 00:18:25 2006
@@ -0,0 +1,82 @@
+<%@page contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
+
+<%--
+
+ Copyright 2006 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.
+
+--%>
+
+<f:view>
+<%@include file="../messages.jspf"%>
+<html>
+<head>
+<title>
+ <h:outputText value="#{messages['exception.correct.title']}"/>
+</title>
+</head>
+<body>
+
+ <h:form id="form">
+
+ <h:messages id="messages"
+ globalOnly="false"/>
+
+ <h:panelGrid id="grid"
+ columns="2">
+
+ <h:outputText value="#{messages['exception.correct.status_code']}"/>
+ <h:outputText id="status_code"
+ value="#{requestScope['javax.servlet.error.status_code']}"/>
+
+ <h:outputText value="#{messages['exception.correct.exception_type']}"/>
+ <h:outputText id="exception_type"
+ value="#{requestScope['javax.servlet.error.exception_type'].name}"/>
+
+ <h:outputText value="#{messages['exception.correct.message']}"/>
+ <h:outputText id="message"
+ value="#{requestScope['javax.servlet.error.message']}"/>
+
+ <h:outputText value="#{messages['exception.correct.request_uri']}"/>
+ <h:outputText id="request_uri"
+ value="#{requestScope['javax.servlet.error.request_uri']}"/>
+
+ <h:outputText value=""/>
+ <h:commandButton id="submit"
+ value="Submit"
+ action="usecases$toplevel"/>
+ <h:outputText value=""/>
+
+ </h:panelGrid>
+
+ <f:verbatim><p></f:verbatim>
+
+ <h:outputText value="#{messages['exception.test.description']}"
+ escape="false"
+ style="font-style: italic"/>
+
+ <f:verbatim><p></f:verbatim>
+
+ <h:commandLink id="back"
+ immediate="true"
+ value="#{messages['usecases.primary']}"
+ action="usecases$toplevel"/>
+
+ </h:form>
+
+</body>
+</html>
+</f:view>
Added: shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/incorrect.jsp
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/incorrect.jsp?rev=429262&view=auto
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/incorrect.jsp (added)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/incorrect.jsp Mon Aug 7 00:18:25 2006
@@ -0,0 +1,66 @@
+<%@page contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
+
+<%--
+
+ Copyright 2006 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.
+
+--%>
+
+<f:view>
+<%@include file="../messages.jspf"%>
+<html>
+<head>
+<title>
+ <h:outputText value="#{messages['exception.incorrect.title']}"/>
+</title>
+</head>
+<body>
+
+ <h:form id="form">
+
+ <h:messages id="messages"
+ globalOnly="false"/>
+
+ <h:panelGrid columns="1"/>
+
+ <h:outputValue value="#{messages['exception.incorrect.message]}"/>
+
+
+ <h:commandButton id="submit"
+ value="Submit"
+ action="usecases$toplevel"/>
+
+ </h:panelGrid>
+
+ <f:verbatim><p></f:verbatim>
+
+ <h:outputText value="#{messages['exception.test.description']}"
+ escape="false"
+ style="font-style: italic"/>
+
+ <f:verbatim><p></f:verbatim>
+
+ <h:commandLink id="back"
+ immediate="true"
+ value="#{messages['usecases.primary']}"
+ action="usecases$toplevel"/>
+
+ </h:form>
+
+</body>
+</html>
+</f:view>
Added: shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/test.jsp
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/test.jsp?rev=429262&view=auto
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/test.jsp (added)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/exception/test.jsp Mon Aug 7 00:18:25 2006
@@ -0,0 +1,66 @@
+<%@page contentType="text/html;charset=UTF-8"%>
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
+
+<%--
+
+ Copyright 2006 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.
+
+--%>
+
+<f:view>
+<%@include file="../messages.jspf"%>
+<html>
+<head>
+<title>
+ <h:outputText value="#{messages['exception.test.title']}"/>
+</title>
+</head>
+<body>
+
+ <h:form id="form">
+
+ <h:messages id="messages"
+ globalOnly="false"/>
+
+ <h:panelGrid id="grid"
+ columns="1">
+
+ <h:outputText value="#{messages['exception.test.message']}"/>
+
+ <h:commandButton id="submit"
+ value="Submit"
+ action="#{exception$test.submit}"/>
+
+ </h:panelGrid>
+
+ <f:verbatim><p></f:verbatim>
+
+ <h:outputText value="#{messages['exception.test.description']}"
+ escape="false"
+ style="font-style: italic"/>
+
+ <f:verbatim><p></f:verbatim>
+
+ <h:commandLink id="back"
+ immediate="true"
+ value="#{messages['usecases.primary']}"
+ action="usecases$toplevel"/>
+
+ </h:form>
+
+</body>
+</html>
+</f:view>
Modified: shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/token/test.jsp
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/token/test.jsp?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/token/test.jsp (original)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/token/test.jsp Mon Aug 7 00:18:25 2006
@@ -40,7 +40,7 @@
columns="3">
<h:outputLabel for="value"
- value="#{messages['token.test.label']}"/>
+ value="#{messages['token.test.message']}"/>
<h:inputText id="value"
required="true"
value="#{token$test.value}"/>
Modified: shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/usecases.jsp
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/usecases.jsp?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/usecases.jsp (original)
+++ shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/usecases.jsp Mon Aug 7 00:18:25 2006
@@ -170,6 +170,18 @@
</h:panelGrid>
+ <h1><h:outputText value="#{messages['usecases.exceptiontests']}"/></h1>
+
+ <h:panelGrid columns="1">
+
+ <h:commandLink id="exceptiontest"
+ action="exception$test">
+ <h:outputText value="#{messages['usecases.exceptiontest']}"/>
+
+ </h:commandLink>
+
+ </h:panelGrid>
+
<h1><h:outputText value="#{messages['usecases.tokentests']}"/></h1>
<h:panelGrid columns="1">
Modified: shale/framework/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java (original)
+++ shale/framework/trunk/shale-core/src/main/java/org/apache/shale/component/Subview.java Mon Aug 7 00:18:25 2006
@@ -195,9 +195,14 @@
*/
private void handleException(FacesContext context, Exception exception) {
- ValueBinding vb = context.getApplication().createValueBinding
- ("#{" + FacesConstants.EXCEPTION_HANDLER + "}");
- ((ExceptionHandler) vb.getValue(context)).handleException(exception);
+ if (context == null) {
+ exception.printStackTrace(System.out);
+ return;
+ }
+ ExceptionHandler handler = (ExceptionHandler)
+ context.getApplication().getVariableResolver().resolveVariable
+ (context, FacesConstants.EXCEPTION_HANDLER);
+ handler.handleException(exception);
}
Modified: shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/LifecycleListener.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/LifecycleListener.java?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/LifecycleListener.java (original)
+++ shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/LifecycleListener.java Mon Aug 7 00:18:25 2006
@@ -747,9 +747,10 @@
exception.printStackTrace(System.out);
return;
}
- ValueBinding vb = context.getApplication().createValueBinding
- ("#{" + FacesConstants.EXCEPTION_HANDLER + "}");
- ((ExceptionHandler) vb.getValue(context)).handleException(exception);
+ ExceptionHandler handler = (ExceptionHandler)
+ context.getApplication().getVariableResolver().resolveVariable
+ (context, FacesConstants.EXCEPTION_HANDLER);
+ handler.handleException(exception);
}
Modified: shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewActionListener.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewActionListener.java?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewActionListener.java (original)
+++ shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewActionListener.java Mon Aug 7 00:18:25 2006
@@ -94,9 +94,10 @@
exception.printStackTrace(System.out);
return;
}
- ValueBinding vb = context.getApplication().createValueBinding
- ("#{" + FacesConstants.EXCEPTION_HANDLER + "}");
- ((ExceptionHandler) vb.getValue(context)).handleException(exception);
+ ExceptionHandler handler = (ExceptionHandler)
+ context.getApplication().getVariableResolver().resolveVariable
+ (context, FacesConstants.EXCEPTION_HANDLER);
+ handler.handleException(exception);
}
Modified: shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewControllerCallbacks.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewControllerCallbacks.java?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewControllerCallbacks.java (original)
+++ shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewControllerCallbacks.java Mon Aug 7 00:18:25 2006
@@ -16,6 +16,8 @@
package org.apache.shale.view.faces;
+import javax.faces.context.FacesContext;
+import org.apache.shale.view.ExceptionHandler;
import org.apache.shale.view.ViewController;
/**
@@ -49,7 +51,11 @@
public void preprocess(Object instance) {
if (instance instanceof ViewController) {
- ((ViewController) instance).preprocess();
+ try {
+ ((ViewController) instance).preprocess();
+ } catch (Exception e) {
+ handleException(FacesContext.getCurrentInstance(), e);
+ }
}
}
@@ -64,8 +70,36 @@
public void prerender(Object instance) {
if (instance instanceof ViewController) {
- ((ViewController) instance).prerender();
+ try {
+ ((ViewController) instance).prerender();
+ } catch (Exception e) {
+ handleException(FacesContext.getCurrentInstance(), e);
+ }
}
+
+ }
+
+
+ // ------------------------------------------------------- Protected Methods
+
+
+ /**
+ * <p>Handle the specified exception according to the strategy
+ * defined by our current {@link ExceptionHandler}.</p>
+ *
+ * @param context FacesContext for the current request
+ * @param exception Exception to be handled
+ */
+ protected void handleException(FacesContext context, Exception exception) {
+
+ if (context == null) {
+ exception.printStackTrace(System.out);
+ return;
+ }
+ ExceptionHandler handler = (ExceptionHandler)
+ context.getApplication().getVariableResolver().resolveVariable
+ (context, FacesConstants.EXCEPTION_HANDLER);
+ handler.handleException(exception);
}
Modified: shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewPhaseListener.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewPhaseListener.java?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewPhaseListener.java (original)
+++ shale/framework/trunk/shale-core/src/main/java/org/apache/shale/view/faces/ViewPhaseListener.java Mon Aug 7 00:18:25 2006
@@ -135,6 +135,7 @@
*/
private void afterInvokeApplication(PhaseEvent event) {
+ System.out.println("Performing afterInvokeApplication()");
// Have we accumulated any exceptions during the current request?
FacesContext context = event.getFacesContext();
ExternalContext econtext = context.getExternalContext();
@@ -148,6 +149,7 @@
String path =
econtext.getInitParameter(Constants.EXCEPTION_DISPATCH_PATH);
if (path == null) {
+ System.out.println("No afterInvokeApplication() init parameter to dispatch to");
return;
}
@@ -175,6 +177,8 @@
// Dispatch to the specified error handler
econtext.dispatch(path);
} catch (IOException e) {
+ System.out.println("Exception during dispatch");
+ e.printStackTrace();
handleException(context, e);
}
@@ -289,9 +293,10 @@
exception.printStackTrace(System.out);
return;
}
- ValueBinding vb = context.getApplication().createValueBinding
- ("#{" + FacesConstants.EXCEPTION_HANDLER + "}");
- ((ExceptionHandler) vb.getValue(context)).handleException(exception);
+ ExceptionHandler handler = (ExceptionHandler)
+ context.getApplication().getVariableResolver().resolveVariable
+ (context, FacesConstants.EXCEPTION_HANDLER);
+ handler.handleException(exception);
}
Modified: shale/framework/trunk/shale-core/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/resources/META-INF/faces-config.xml?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-core/src/main/resources/META-INF/faces-config.xml (original)
+++ shale/framework/trunk/shale-core/src/main/resources/META-INF/faces-config.xml Mon Aug 7 00:18:25 2006
@@ -110,7 +110,7 @@
Default implementation of org.apache.shale.view.ExceptionHandler
used to process application-triggered exceptions.
</description>
- <managed-bean-name>org$apache.$shale$view$EXCEPTION_HANDLER</managed-bean-name>
+ <managed-bean-name>org$apache$shale$view$EXCEPTION_HANDLER</managed-bean-name>
<managed-bean-class>org.apache.shale.view.impl.DefaultExceptionHandler</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
Modified: shale/framework/trunk/shale-tiger/src/main/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-tiger/src/main/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java?rev=429262&r1=429261&r2=429262&view=diff
==============================================================================
--- shale/framework/trunk/shale-tiger/src/main/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java (original)
+++ shale/framework/trunk/shale-tiger/src/main/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java Mon Aug 7 00:18:25 2006
@@ -124,26 +124,6 @@
/**
- * <p>Handle the specified exception according to the strategy
- * defined by our current {@link ExceptionHandler}.</p>
- *
- * @param context FacesContext for the current request
- * @param exception Exception to be handled
- */
- private void handleException(FacesContext context, Exception exception) {
-
- if (context == null) {
- exception.printStackTrace(System.out);
- return;
- }
- ValueBinding vb = context.getApplication().createValueBinding
- ("#{" + FacesConstants.EXCEPTION_HANDLER + "}");
- ((ExceptionHandler) vb.getValue(context)).handleException(exception);
-
- }
-
-
- /**
* <p>The set of method annotations for callbacks of interest.</p>
*/
private static final Class[] annotations =