| 1 package com.icesoft.faces.facelets; 2 3 import javax.faces.application.ViewHandler; 4 5 import com.icesoft.util.SeamUtilities; 6 import com.sun.facelets.compiler.Compiler; 7 import com.sun.facelets.compiler.SAXCompiler; 8 import com.sun.facelets.impl.ResourceResolver; 9 import org.apache.commons.logging.Log; 10 import org.apache.commons.logging.LogFactory; 11 12 15 public class D2DSeamFaceletViewHandler extends D2DFaceletViewHandler { 16 17 private static final String SEAM_EXPRESSION_FACTORY = "org.jboss.seam.ui.facelet.SeamExpressionFactory"; 18 19 private static Log log = LogFactory.getLog(D2DSeamFaceletViewHandler.class); 21 22 public D2DSeamFaceletViewHandler(ViewHandler delegate) { 23 super(delegate); 24 } 25 26 protected void faceletInitialize() { 27 34 try { 35 if( faceletFactory == null ) { 36 com.sun.facelets.compiler.Compiler c = new SAXCompiler(); 37 if ( SeamUtilities.requiresSeamExpressionFactory()){ 38 c.setFeature( Compiler.EXPRESSION_FACTORY, SEAM_EXPRESSION_FACTORY ); 39 } initializeCompiler( c ); 41 faceletFactory = createFaceletFactory( c ); 42 } 43 } 44 catch (Throwable t) { 45 if( log.isDebugEnabled() ) { 46 log.debug("Failed initializing facelet instance", t); 47 } 48 } 49 } 50 51 54 protected ResourceResolver preChainResourceResolver(ResourceResolver after) { 55 ResourceResolver seamDebugResourceResolver = 56 SeamDebugResourceResolver.build(after); 57 if( seamDebugResourceResolver != null ) 58 return seamDebugResourceResolver; 59 else 60 return after; 61 } 62 63 } 64 | Popular Tags |