You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/12/28 22:57:43 UTC
svn commit: r894255 [2/2] - in /myfaces/core/trunk:
api/src/main/java/javax/faces/component/
api/src/main/java/javax/faces/webapp/
impl/src/main/java/org/apache/myfaces/application/
impl/src/main/java/org/apache/myfaces/lifecycle/ impl/src/main/java/or...
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java?rev=894255&r1=894254&r2=894255&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java Mon Dec 28 21:57:35 2009
@@ -19,10 +19,15 @@
package org.apache.myfaces.view.facelets.tag.ui;
import java.io.IOException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import javax.el.ELException;
import javax.el.VariableMapper;
import javax.faces.FacesException;
+import javax.faces.application.ProjectStage;
import javax.faces.component.UIComponent;
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.FaceletException;
@@ -50,6 +55,9 @@
public final class IncludeHandler extends TagHandler
{
+ private static final String ERROR_PAGE_INCLUDE_PATH = "javax.faces.error.xhtml";
+ private static final String ERROR_FACELET = "META-INF/rsc/myfaces-dev-error-include.xhtml";
+
/**
* A literal or EL expression that specifies the target Facelet that you
* would like to include into your document.
@@ -87,7 +95,39 @@
try
{
this.nextHandler.apply(ctx, null);
- ctx.includeFacelet(parent, path);
+ // if we are in ProjectStage Development and the path equals "javax.faces.error.xhtml"
+ // we should include the default error page
+ if (ctx.getFacesContext().isProjectStage(ProjectStage.Development)
+ && ERROR_PAGE_INCLUDE_PATH.equals(path))
+ {
+ URL url;
+ if (System.getSecurityManager()!=null)
+ {
+ try
+ {
+ ClassLoader cl = AccessController.<ClassLoader>doPrivileged(new PrivilegedExceptionAction<ClassLoader>() {
+ public ClassLoader run() throws PrivilegedActionException
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ url = cl.getResource(ERROR_FACELET);
+ }
+ catch (PrivilegedActionException pae)
+ {
+ throw new FacesException(pae);
+ }
+ }
+ else
+ {
+ url = Thread.currentThread().getContextClassLoader().getResource(ERROR_FACELET);
+ }
+ ctx.includeFacelet(parent, url);
+ }
+ else
+ {
+ ctx.includeFacelet(parent, path);
+ }
}
finally
{
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UIDebug.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UIDebug.java?rev=894255&r1=894254&r2=894255&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UIDebug.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/UIDebug.java Mon Dec 28 21:57:35 2009
@@ -34,7 +34,7 @@
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspProperty;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
-import org.apache.myfaces.view.facelets.util.DevTools;
+import org.apache.myfaces.renderkit.ErrorPageWriter;
import org.apache.myfaces.view.facelets.util.FastWriter;
/**
@@ -124,7 +124,7 @@
private static String writeDebugOutput(FacesContext faces) throws IOException
{
FastWriter fw = new FastWriter();
- DevTools.debugHtml(fw, faces);
+ ErrorPageWriter.debugHtml(fw, faces);
Map<String, Object> session = faces.getExternalContext().getSessionMap();
Map<String, String> debugs = (Map<String, String>) session.get(KEY);
Added: myfaces/core/trunk/impl/src/main/resources/META-INF/rsc/myfaces-dev-error-include.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/resources/META-INF/rsc/myfaces-dev-error-include.xhtml?rev=894255&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/resources/META-INF/rsc/myfaces-dev-error-include.xhtml (added)
+++ myfaces/core/trunk/impl/src/main/resources/META-INF/rsc/myfaces-dev-error-include.xhtml Mon Dec 28 21:57:35 2009
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+ <ui:composition>
+ <h:outputText value="#{__myFacesErrorPageBean.errorPageHtml}" escape="false" />
+ </ui:composition>
+
+</html>