myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sless...@apache.org
Subject svn commit: r740940 [1/9] - in /myfaces/core/branches/2_0_0: api/src/main/java/javax/faces/webapp/pdl/facelets/ api/src/main/resources/META-INF/ impl/src/main/java/com/ impl/src/main/java/com/sun/ impl/src/main/java/com/sun/facelets/ impl/src/main/java...
Date Wed, 04 Feb 2009 23:55:29 GMT
Author: slessard
Date: Wed Feb  4 23:55:25 2009
New Revision: 740940

URL: http://svn.apache.org/viewvc?rev=740940&view=rev
Log:
Dropped latest Facelets code. Not compiling correctly yet as there's some file header issues and I'm getting a teammate help to fix those. For now, I also didn't rename the packages although it I think it's going to be required before releasing so that it's possible to drop in the latest Facelets version in a JSF 2.0 application an not suffer from class version errors.

Added:
    myfaces/core/branches/2_0_0/impl/src/main/java/com/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/Facelet.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletFactory.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletViewHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/StateWriter.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/TemplateClient.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AbstractUIHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AttributeInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/CommentInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/CompilationManager.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/CompilationUnit.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/Compiler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/EncodingHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/EndElementInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/Instruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/LiteralAttributeInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/LiteralCommentInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/LiteralTextInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/LiteralXMLInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/NamespaceHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/NamespaceManager.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/NamespaceUnit.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/RemoveUnit.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/SAXCompiler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/StartElementInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/TagLibraryConfig.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/TagUnit.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/TextInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/TextUnit.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/TrimmedTagUnit.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/UIInstructionHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/UIInstructions.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/UILeaf.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/UILiteralText.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/UILiteralTextHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/UIText.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/UITextHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/XMLInstruction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/component/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/component/RepeatRenderer.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/component/UIRepeat.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/CompositeFunctionMapper.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/CompositeVariableMapper.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultFunctionMapper.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/DefaultVariableMapper.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/ELAdaptor.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/ELText.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/LegacyELContext.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/LegacyMethodBinding.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/LegacyValueBinding.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/TagMethodExpression.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/TagValueExpression.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/VariableMapperWrapper.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/el/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFacelet.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletContext.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultFaceletFactory.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/DefaultResourceResolver.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/ResourceResolver.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/impl/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/AbstractTagLibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/BeanPropertyTagRule.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/CompositeFaceletHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/CompositeTagDecorator.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/CompositeTagLibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/Location.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaRule.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaRuleset.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaRulesetImpl.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetaTagHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/Metadata.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetadataImpl.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetadataTarget.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MetadataTargetImpl.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/MethodRule.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/Tag.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagAttribute.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagAttributeException.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagAttributes.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagConfig.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagDecorator.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagException.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagHandlerFactory.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TagLibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/TextHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/UserTagHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ActionSourceRule.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ComponentConfig.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ComponentHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ComponentRule.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ComponentSupport.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ConvertHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ConverterConfig.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/EditableValueHolderRule.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ValidateHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ValidatorConfig.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/ValueHolderRule.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/ActionListenerHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/AttributeHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/ConvertDateTimeHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/ConvertDelegateHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/ConvertNumberHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/CoreLibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/FacetHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/LoadBundleHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/PhaseListenerHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/SetPropertyActionListenerHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/ValidateDelegateHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/ValueChangeListenerHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/VerbatimHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/ViewHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/core/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/html/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/html/AbstractHtmlLibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/html/HtmlComponentHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/html/HtmlDecorator.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/html/HtmlLibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jsf/html/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/CatchHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/ChooseHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/ChooseOtherwiseHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/ChooseWhenHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/ForEachHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/IfHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/IndexedValueExpression.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/IteratedValueExpression.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/IterationStatus.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/IterationStatusExpression.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/JstlCoreLibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/MappedValueExpression.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/SetHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/core/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/fn/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/fn/JstlFnLibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/fn/JstlFunction.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/jstl/fn/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/ComponentRef.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/ComponentRefHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/CompositionHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/DecorateHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/DefineHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/IncludeHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/InsertHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/ParamHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/RepeatHandler.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/UIDebug.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/UILibrary.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/tag/ui/package.html
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/Classpath.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/DevTools.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/FacesAPI.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/FastWriter.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/ParameterCheck.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/Path.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/ReflectionUtil.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/Resource.java
    myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/util/package.html
Modified:
    myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletContext.java
    myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletHandler.java
    myfaces/core/branches/2_0_0/api/src/main/resources/META-INF/NOTICE.txt
    myfaces/core/branches/2_0_0/impl/src/main/resources/META-INF/NOTICE.txt

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletContext.java?rev=740940&r1=740939&r2=740940&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletContext.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletContext.java Wed Feb  4 23:55:25 2009
@@ -22,13 +22,20 @@
 import java.net.URL;
 
 import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ExpressionFactory;
 import javax.el.FunctionMapper;
 import javax.el.VariableMapper;
+import javax.faces.FacesException;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
 /**
- * @author Simon Lessard (latest modification by $Author: slessard $)
+ * The parent or root object in a FaceletHandler composition. The Facelet will
+ * take care of populating the passed UIComponent parent in relation to the
+ * create/restore lifecycle of JSF.
+ * 
+ * @author Jacob Hookom (latest modification by $Author: slessard $)
  * @version $Revision: 696523 $ $Date: 2008-12-10 18:39:00 -0400 (mer., 17 sept. 2008) $
  *
  * @since 2.0
@@ -38,21 +45,82 @@
     // TODO: Report that aberration to the EG
     public static final String FACELET_CONTEXT_KEY = "com.sun.faces.facelets.FACELET_CONTEXT";
     
+    /**
+     * Generate a unique ID for the passed String
+     * 
+     * @param base
+     * @return a unique ID given the passed base
+     */
     public abstract String generateUniqueId(String base);
-    
+
+    /**
+     * Support method which is backed by the current VariableMapper
+     * 
+     * @param name
+     * @return an Object specified for that name
+     */
     public abstract Object getAttribute(String name);
-    
-    public abstract javax.el.ExpressionFactory getExpressionFactory();
-    
+
+    /**
+     * The ExpressionFactory to use within the Facelet this context is executing upon.
+     * 
+     * @return cannot be null
+     */
+    public abstract ExpressionFactory getExpressionFactory();
+
+    /**
+     * The current FacesContext bound to this "request"
+     * 
+     * @return cannot be null
+     */
     public abstract FacesContext getFacesContext();
-    
-    public abstract void includeFacelet(UIComponent parent, String relativePath) throws IOException;
-    
-    public abstract void includeFacelet(UIComponent parent, URL absolutePath) throws IOException;
-    
+
+    /**
+     * Include another Facelet defined at some path, relative to the executing context, not the current Facelet (same as
+     * include directive in JSP)
+     * 
+     * @param parent
+     * @param relativePath
+     * @throws IOException
+     * @throws FaceletException
+     * @throws FacesException
+     * @throws ELException
+     */
+    public abstract void includeFacelet(UIComponent parent, String relativePath) throws IOException, FaceletException,
+            FacesException, ELException;
+
+    /**
+     * Include another Facelet defined at some path, absolute to this ClassLoader/OS
+     * 
+     * @param parent
+     * @param absolutePath
+     * @throws IOException
+     * @throws FaceletException
+     * @throws FacesException
+     * @throws ELException
+     */
+    public abstract void includeFacelet(UIComponent parent, URL absolutePath) throws IOException, FaceletException,
+            FacesException, ELException;
+
+    /**
+     * Support method which is backed by the current VariableMapper
+     * 
+     * @param name
+     * @param value
+     */
     public abstract void setAttribute(String name, Object value);
-    
-    public abstract void setFunctionMapper(FunctionMapper mapper);
-    
-    public abstract void setVariableMapper(VariableMapper mapper);
+
+    /**
+     * Set the FunctionMapper to use in EL evaluation/creation
+     * 
+     * @param fnMapper
+     */
+    public abstract void setFunctionMapper(FunctionMapper fnMapper);
+
+    /**
+     * Set the VariableMapper to use in EL evaluation/creation
+     * 
+     * @param varMapper
+     */
+    public abstract void setVariableMapper(VariableMapper varMapper);
 }

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletHandler.java?rev=740940&r1=740939&r2=740940&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletHandler.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/webapp/pdl/facelets/FaceletHandler.java Wed Feb  4 23:55:25 2009
@@ -18,16 +18,32 @@
  */
 package javax.faces.webapp.pdl.facelets;
 
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
 /**
- * @author Simon Lessard (latest modification by $Author: slessard $)
+ * A participant in UIComponent tree building
+ * 
+ * @author Jacob Hookom (latest modification by $Author: slessard $)
  * @version $Revision: 696523 $ $Date: 2008-12-10 18:36:19 -0400 (mer., 17 sept. 2008) $
  *
  * @since 2.0
  */
 public interface FaceletHandler
 {
+    /**
+     * Process changes on a particular UIComponent
+     * 
+     * @param ctx the current FaceletContext instance for this execution
+     * @param parent the parent UIComponent to operate upon
+     * @throws IOException
+     * @throws FacesException
+     * @throws FaceletException
+     * @throws ELException
+     */
     public void apply(FacesContext ctx, UIComponent parent);
 }

Modified: myfaces/core/branches/2_0_0/api/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/resources/META-INF/NOTICE.txt?rev=740940&r1=740939&r2=740940&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/resources/META-INF/NOTICE.txt (original)
+++ myfaces/core/branches/2_0_0/api/src/main/resources/META-INF/NOTICE.txt Wed Feb  4 23:55:25 2009
@@ -6,3 +6,5 @@
 See licenses for accompanying products in the "/licenses" subdirectory.
 ------------------------------------------------------------------------
 
+This software also includes code from Facelets (https://facelets.dev.java.net/)
+for the purpose of implementing Facelets PDL for JSF 2.0 support.

Added: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/Facelet.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/Facelet.java?rev=740940&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/Facelet.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/Facelet.java Wed Feb  4 23:55:25 2009
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package com.sun.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.webapp.pdl.facelets.FaceletException;
+
+/**
+ * The parent or root object in a FaceletHandler composition. The Facelet will take care of populating the passed
+ * UIComponent parent in relation to the create/restore lifecycle of JSF.
+ * 
+ * @author Jacob Hookom
+ * @version $Id: Facelet.java,v 1.3 2008/07/13 19:01:40 rlubke Exp $
+ */
+public abstract class Facelet
+{
+
+    /**
+     * The passed UIComponent parent will be populated/restored in accordance with the JSF 1.2 specification.
+     * 
+     * @param facesContext
+     *            The current FacesContext (Should be the same as FacesContext.getInstance())
+     * @param parent
+     *            The UIComponent to populate in a compositional fashion. In most cases a Facelet will be base a
+     *            UIViewRoot.
+     * @throws IOException
+     * @throws FacesException
+     * @throws FaceletException
+     * @throws ELException
+     */
+    public abstract void apply(FacesContext facesContext, UIComponent parent) throws IOException, FacesException,
+            FaceletException, ELException;
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletFactory.java?rev=740940&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletFactory.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletFactory.java Wed Feb  4 23:55:25 2009
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package com.sun.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+
+/**
+ * FaceletFactory for producing Facelets relative to the context of the underlying implementation.
+ * 
+ * @author Jacob Hookom
+ * @version $Id: FaceletFactory.java,v 1.4 2008/07/13 19:01:39 rlubke Exp $
+ */
+public abstract class FaceletFactory
+{
+
+    private static ThreadLocal Instance = new ThreadLocal();
+
+    /**
+     * Return a Facelet instance as specified by the file at the passed URI.
+     * 
+     * @param uri
+     * @return
+     * @throws IOException
+     * @throws FaceletException
+     * @throws FacesException
+     * @throws ELException
+     */
+    public abstract Facelet getFacelet(String uri) throws IOException, FaceletException, FacesException, ELException;
+
+    /**
+     * Set the static instance
+     * 
+     * @param factory
+     */
+    public static final void setInstance(FaceletFactory factory)
+    {
+        Instance.set(factory);
+    }
+
+    /**
+     * Get the static instance
+     * 
+     * @return
+     */
+    public static final FaceletFactory getInstance()
+    {
+        return (FaceletFactory) Instance.get();
+    }
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletViewHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletViewHandler.java?rev=740940&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletViewHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/FaceletViewHandler.java Wed Feb  4 23:55:25 2009
@@ -0,0 +1,973 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package com.sun.facelets;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.application.StateManager;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.sun.facelets.compiler.Compiler;
+import com.sun.facelets.compiler.SAXCompiler;
+import com.sun.facelets.compiler.TagLibraryConfig;
+import com.sun.facelets.impl.DefaultFaceletFactory;
+import com.sun.facelets.impl.DefaultResourceResolver;
+import com.sun.facelets.impl.ResourceResolver;
+import com.sun.facelets.tag.TagDecorator;
+import com.sun.facelets.tag.TagLibrary;
+import com.sun.facelets.tag.jsf.ComponentSupport;
+import com.sun.facelets.tag.ui.UIDebug;
+import com.sun.facelets.util.DevTools;
+import com.sun.facelets.util.FacesAPI;
+import com.sun.facelets.util.ReflectionUtil;
+
+/**
+ * ViewHandler implementation for Facelets
+ * 
+ * @author Jacob Hookom
+ * @version $Id: FaceletViewHandler.java,v 1.49.2.6 2006/03/20 07:22:00 jhook Exp $
+ */
+public class FaceletViewHandler extends ViewHandler
+{
+
+    protected final static Logger log = Logger.getLogger("facelets.viewhandler");
+
+    public final static long DEFAULT_REFRESH_PERIOD = 2;
+
+    public final static String PARAM_REFRESH_PERIOD = "facelets.REFRESH_PERIOD";
+
+    /**
+     * Spelling error, We'll remove this in a future release.
+     * 
+     * @deprecated
+     */
+    public final static String PARAM_REFRESH_PERIO = PARAM_REFRESH_PERIOD;
+
+    public final static String PARAM_SKIP_COMMENTS = "facelets.SKIP_COMMENTS";
+
+    /**
+     * Context initialization parameter for defining what viewIds should be handled by Facelets, and what should not.
+     * When left unset, all URLs will be handled by Facelets. When set, it must be a semicolon separated list of either
+     * extension mappings or prefix mappings. For example:
+     * 
+     * <pre>
+     * 
+     * 
+     * 
+     *        &lt;context-param&gt;
+     *          &lt;param-name&gt;facelets.VIEW_MAPPINGS&lt;/param-name&gt;
+     *          &lt;param-value&gt;/demos/*; *.xhtml&lt;/param-value&gt;
+     *        &lt;/context-param&gt;
+     * 
+     * 
+     * 
+     * </pre>
+     * 
+     * would use Facelets for processing all viewIds in the "/demos" directory or that end in .xhtml, and use the
+     * standard JSP engine for all other viewIds.
+     * <p>
+     * <strong>NOTE</strong>: when using this parameter, you need to use prefix-mapping for the
+     * <code>FacesServlet</code> (that is, <code>/faces/*</code>, not <code>*.jsf</code>).
+     * </p>
+     */
+    public final static String PARAM_VIEW_MAPPINGS = "facelets.VIEW_MAPPINGS";
+
+    public final static String PARAM_LIBRARIES = "facelets.LIBRARIES";
+
+    public final static String PARAM_DECORATORS = "facelets.DECORATORS";
+
+    public final static String PARAM_DEVELOPMENT = "facelets.DEVELOPMENT";
+
+    public final static String PARAM_RESOURCE_RESOLVER = "facelets.RESOURCE_RESOLVER";
+
+    public final static String PARAM_BUILD_BEFORE_RESTORE = "facelets.BUILD_BEFORE_RESTORE";
+
+    public final static String PARAM_BUFFER_SIZE = "facelets.BUFFER_SIZE";
+
+    private final static String STATE_KEY = "~facelets.VIEW_STATE~";
+
+    private final static int STATE_KEY_LEN = STATE_KEY.length();
+
+    private final static Object STATE_NULL = new Object();
+
+    private final ViewHandler parent;
+
+    private boolean developmentMode = false;
+
+    private boolean buildBeforeRestore = false;
+
+    private int bufferSize;
+
+    private String defaultSuffix;
+
+    private FaceletFactory faceletFactory;
+
+    // Array of viewId extensions that should be handled by Facelets
+    private String[] extensionsArray;
+
+    // Array of viewId prefixes that should be handled by Facelets
+    private String[] prefixesArray;
+
+    /**
+     *
+     */
+    public FaceletViewHandler(ViewHandler parent)
+    {
+        this.parent = parent;
+    }
+
+    /**
+     * Initialize the ViewHandler during its first request.
+     */
+    protected void initialize(FacesContext context)
+    {
+        synchronized (this)
+        {
+            if (this.faceletFactory == null)
+            {
+                log.fine("Initializing");
+                Compiler c = this.createCompiler();
+                this.initializeCompiler(c);
+                this.faceletFactory = this.createFaceletFactory(c);
+
+                this.initializeMappings(context);
+                this.initializeMode(context);
+                this.initializeBuffer(context);
+
+                log.fine("Initialization Successful");
+            }
+        }
+    }
+
+    private void initializeMode(FacesContext context)
+    {
+        ExternalContext external = context.getExternalContext();
+        String param = external.getInitParameter(PARAM_DEVELOPMENT);
+        this.developmentMode = "true".equals(param);
+
+        String restoreMode = external.getInitParameter(PARAM_BUILD_BEFORE_RESTORE);
+        this.buildBeforeRestore = "true".equals(restoreMode);
+    }
+
+    private void initializeBuffer(FacesContext context)
+    {
+        ExternalContext external = context.getExternalContext();
+        String param = external.getInitParameter(PARAM_BUFFER_SIZE);
+        this.bufferSize = (param != null && !"".equals(param)) ? Integer.parseInt(param) : -1;
+    }
+
+    /**
+     * Initialize mappings, during the first request.
+     */
+    private void initializeMappings(FacesContext context)
+    {
+        ExternalContext external = context.getExternalContext();
+        String viewMappings = external.getInitParameter(PARAM_VIEW_MAPPINGS);
+        if ((viewMappings != null) && (viewMappings.length() > 0))
+        {
+            String[] mappingsArray = viewMappings.split(";");
+
+            List extensionsList = new ArrayList(mappingsArray.length);
+            List prefixesList = new ArrayList(mappingsArray.length);
+
+            for (int i = 0; i < mappingsArray.length; i++)
+            {
+                String mapping = mappingsArray[i].trim();
+                int mappingLength = mapping.length();
+                if (mappingLength <= 1)
+                {
+                    continue;
+                }
+
+                if (mapping.charAt(0) == '*')
+                {
+                    extensionsList.add(mapping.substring(1));
+                }
+                else if (mapping.charAt(mappingLength - 1) == '*')
+                {
+                    prefixesList.add(mapping.substring(0, mappingLength - 1));
+                }
+            }
+
+            extensionsArray = new String[extensionsList.size()];
+            extensionsList.toArray(extensionsArray);
+
+            prefixesArray = new String[prefixesList.size()];
+            prefixesList.toArray(prefixesArray);
+        }
+    }
+
+    protected FaceletFactory createFaceletFactory(Compiler c)
+    {
+
+        // refresh period
+        long refreshPeriod = DEFAULT_REFRESH_PERIOD;
+        FacesContext ctx = FacesContext.getCurrentInstance();
+        String userPeriod = ctx.getExternalContext().getInitParameter(PARAM_REFRESH_PERIOD);
+        if (userPeriod != null && userPeriod.length() > 0)
+        {
+            refreshPeriod = Long.parseLong(userPeriod);
+        }
+
+        // resource resolver
+        ResourceResolver resolver = new DefaultResourceResolver();
+        String resolverName = ctx.getExternalContext().getInitParameter(PARAM_RESOURCE_RESOLVER);
+        if (resolverName != null && resolverName.length() > 0)
+        {
+            try
+            {
+                resolver = (ResourceResolver) ReflectionUtil.forName(resolverName).newInstance();
+            }
+            catch (Exception e)
+            {
+                throw new FacesException("Error Initializing ResourceResolver[" + resolverName + "]", e);
+            }
+        }
+
+        // Resource.getResourceUrl(ctx,"/")
+        return new DefaultFaceletFactory(c, resolver, refreshPeriod);
+    }
+
+    protected Compiler createCompiler()
+    {
+        return new SAXCompiler();
+    }
+
+    protected void initializeCompiler(Compiler c)
+    {
+        FacesContext ctx = FacesContext.getCurrentInstance();
+        ExternalContext ext = ctx.getExternalContext();
+
+        // load libraries
+        String libParam = ext.getInitParameter(PARAM_LIBRARIES);
+        if (libParam != null)
+        {
+            libParam = libParam.trim();
+            String[] libs = libParam.split(";");
+            URL src;
+            TagLibrary libObj;
+            for (int i = 0; i < libs.length; i++)
+            {
+                try
+                {
+                    src = ext.getResource(libs[i].trim());
+                    if (src == null)
+                    {
+                        throw new FileNotFoundException(libs[i]);
+                    }
+                    libObj = TagLibraryConfig.create(src);
+                    c.addTagLibrary(libObj);
+                    log.fine("Successfully Loaded Library: " + libs[i]);
+                }
+                catch (IOException e)
+                {
+                    log.log(Level.SEVERE, "Error Loading Library: " + libs[i], e);
+                }
+            }
+        }
+
+        // load decorators
+        String decParam = ext.getInitParameter(PARAM_DECORATORS);
+        if (decParam != null)
+        {
+            decParam = decParam.trim();
+            String[] decs = decParam.split(";");
+            TagDecorator decObj;
+            for (int i = 0; i < decs.length; i++)
+            {
+                try
+                {
+                    decObj = (TagDecorator) ReflectionUtil.forName(decs[i]).newInstance();
+                    c.addTagDecorator(decObj);
+                    log.fine("Successfully Loaded Decorator: " + decs[i]);
+                }
+                catch (Exception e)
+                {
+                    log.log(Level.SEVERE, "Error Loading Decorator: " + decs[i], e);
+                }
+            }
+        }
+
+        // skip params?
+        String skipParam = ext.getInitParameter(PARAM_SKIP_COMMENTS);
+        if (skipParam != null && "true".equals(skipParam))
+        {
+            c.setTrimmingComments(true);
+        }
+    }
+
+    public UIViewRoot restoreView(FacesContext context, String viewId)
+    {
+        if (UIDebug.debugRequest(context))
+        {
+            return new UIViewRoot();
+        }
+
+        if (!this.buildBeforeRestore || !handledByFacelets(viewId))
+        {
+            return this.parent.restoreView(context, viewId);
+        }
+
+        if (this.faceletFactory == null)
+        {
+            this.initialize(context);
+        }
+
+        // In JSF 1.2, restoreView() will only be called on postback.
+        // But in JSF 1.1, it will be called for an initial request too,
+        // in which case we must return null in order to fall through
+        // to createView()
+        if (FacesAPI.getVersion() < 12)
+        {
+            if (!isPostback11(context))
+            {
+                return null;
+            }
+        }
+
+        ViewHandler outerViewHandler = context.getApplication().getViewHandler();
+        String renderKitId = outerViewHandler.calculateRenderKitId(context);
+
+        UIViewRoot viewRoot = createView(context, viewId);
+        context.setViewRoot(viewRoot);
+        try
+        {
+            this.buildView(context, viewRoot);
+        }
+        catch (IOException ioe)
+        {
+            log.log(Level.SEVERE, "Error Building View", ioe);
+        }
+        context.getApplication().getStateManager().restoreView(context, viewId, renderKitId);
+        return viewRoot;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.faces.application.ViewHandlerWrapper#getWrapped()
+     */
+    protected ViewHandler getWrapped()
+    {
+        return this.parent;
+    }
+
+    protected ResponseWriter createResponseWriter(FacesContext context) throws IOException, FacesException
+    {
+        ExternalContext extContext = context.getExternalContext();
+        RenderKit renderKit = context.getRenderKit();
+        // Avoid a cryptic NullPointerException when the renderkit ID
+        // is incorrectly set
+        if (renderKit == null)
+        {
+            String id = context.getViewRoot().getRenderKitId();
+            throw new IllegalStateException("No render kit was available for id \"" + id + "\"");
+        }
+
+        ServletResponse response = (ServletResponse) extContext.getResponse();
+
+        // set the buffer for content
+        if (this.bufferSize != -1)
+        {
+            response.setBufferSize(this.bufferSize);
+        }
+
+        // get our content type
+        String contentType = (String) extContext.getRequestMap().get("facelets.ContentType");
+
+        // get the encoding
+        String encoding = (String) extContext.getRequestMap().get("facelets.Encoding");
+
+        ResponseWriter writer;
+        // append */* to the contentType so createResponseWriter will succeed no matter
+        // the requested contentType.
+        if (contentType != null && !contentType.equals("*/*"))
+        {
+            contentType += ",*/*";
+        }
+        // Create a dummy ResponseWriter with a bogus writer,
+        // so we can figure out what content type the ReponseWriter
+        // is really going to ask for
+        try
+        {
+            writer = renderKit.createResponseWriter(NullWriter.Instance, contentType, encoding);
+        }
+        catch (IllegalArgumentException e)
+        {
+            // Added because of an RI bug prior to 1.2_05-b3. Might as well leave it in case other
+            // impls have the same problem. https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=613
+            log.fine("The impl didn't correctly handled '*/*' in the content type list.  Trying '*/*' directly.");
+            writer = renderKit.createResponseWriter(NullWriter.Instance, "*/*", encoding);
+        }
+
+        // Override the JSF provided content type if necessary
+        contentType = getResponseContentType(context, writer.getContentType());
+        encoding = getResponseEncoding(context, writer.getCharacterEncoding());
+
+        // apply them to the response
+        response.setContentType(contentType + "; charset=" + encoding);
+
+        // removed 2005.8.23 to comply with J2EE 1.3
+        // response.setCharacterEncoding(encoding);
+
+        // Now, clone with the real writer
+        writer = writer.cloneWithWriter(response.getWriter());
+
+        return writer;
+    }
+
+    /**
+     * Generate the encoding
+     * 
+     * @param context
+     * @param orig
+     * @return
+     */
+    protected String getResponseEncoding(FacesContext context, String orig)
+    {
+        String encoding = orig;
+
+        // see if we need to override the encoding
+        Map m = context.getExternalContext().getRequestMap();
+        Map sm = context.getExternalContext().getSessionMap();
+
+        // 1. check the request attribute
+        if (m.containsKey("facelets.Encoding"))
+        {
+            encoding = (String) m.get("facelets.Encoding");
+            if (log.isLoggable(Level.FINEST))
+            {
+                log.finest("Facelet specified alternate encoding '" + encoding + "'");
+            }
+            sm.put(CHARACTER_ENCODING_KEY, encoding);
+        }
+
+        // 2. get it from request
+        Object request = context.getExternalContext().getRequest();
+        if (encoding == null && request instanceof ServletRequest)
+        {
+            encoding = ((ServletRequest) request).getCharacterEncoding();
+        }
+
+        // 3. get it from the session
+        if (encoding == null)
+        {
+            encoding = (String) sm.get(CHARACTER_ENCODING_KEY);
+            if (log.isLoggable(Level.FINEST))
+            {
+                log.finest("Session specified alternate encoding '" + encoding + "'");
+            }
+        }
+
+        // 4. default it
+        if (encoding == null)
+        {
+            encoding = "UTF-8";
+            if (log.isLoggable(Level.FINEST))
+            {
+                log.finest("ResponseWriter created had a null CharacterEncoding, defaulting to UTF-8");
+            }
+        }
+
+        return encoding;
+    }
+
+    /**
+     * Generate the content type
+     * 
+     * @param context
+     * @param orig
+     * @return
+     */
+    protected String getResponseContentType(FacesContext context, String orig)
+    {
+        String contentType = orig;
+
+        // see if we need to override the contentType
+        Map m = context.getExternalContext().getRequestMap();
+        if (m.containsKey("facelets.ContentType"))
+        {
+            contentType = (String) m.get("facelets.ContentType");
+            if (log.isLoggable(Level.FINEST))
+            {
+                log.finest("Facelet specified alternate contentType '" + contentType + "'");
+            }
+        }
+
+        // safety check
+        if (contentType == null)
+        {
+            contentType = "text/html";
+            if (log.isLoggable(Level.FINEST))
+            {
+                log.finest("ResponseWriter created had a null ContentType, defaulting to text/html");
+            }
+        }
+
+        return contentType;
+    }
+
+    protected void buildView(FacesContext context, UIViewRoot viewToRender) throws IOException, FacesException
+    {
+        // setup our viewId
+        String renderedViewId = this.getRenderedViewId(context, viewToRender.getViewId());
+        viewToRender.setViewId(renderedViewId);
+
+        if (log.isLoggable(Level.FINE))
+        {
+            log.fine("Building View: " + renderedViewId);
+        }
+
+        // grab our FaceletFactory and create a Facelet
+        Facelet f = null;
+        FaceletFactory.setInstance(this.faceletFactory);
+        try
+        {
+            f = this.faceletFactory.getFacelet(viewToRender.getViewId());
+        }
+        finally
+        {
+            FaceletFactory.setInstance(null);
+        }
+
+        // populate UIViewRoot
+        long time = System.currentTimeMillis();
+        f.apply(context, viewToRender);
+        time = System.currentTimeMillis() - time;
+        if (log.isLoggable(Level.FINE))
+        {
+            log.fine("Took " + time + "ms to build view: " + viewToRender.getViewId());
+        }
+    }
+
+    public void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException, FacesException
+    {
+
+        // lazy initialize so we have a FacesContext to use
+        if (this.faceletFactory == null)
+        {
+            this.initialize(context);
+        }
+
+        // exit if the view is not to be rendered
+        if (!viewToRender.isRendered())
+        {
+            return;
+        }
+
+        // if facelets is not supposed to handle this request
+        if (!handledByFacelets(viewToRender.getViewId()))
+        {
+            this.parent.renderView(context, viewToRender);
+            return;
+        }
+
+        // log request
+        if (log.isLoggable(Level.FINE))
+        {
+            log.fine("Rendering View: " + viewToRender.getViewId());
+        }
+
+        StateWriter stateWriter = null;
+        try
+        {
+            // build view - but not if we're in "buildBeforeRestore"
+            // land and we've already got a populated view. Note
+            // that this optimizations breaks if there's a "c:if" in
+            // the page that toggles as a result of request processing -
+            // should that be handled? Or
+            // is this optimization simply so minor that it should just
+            // be trimmed altogether?
+            if (!this.buildBeforeRestore || viewToRender.getChildren().isEmpty())
+            {
+                this.buildView(context, viewToRender);
+            }
+
+            // setup writer and assign it to the context
+            ResponseWriter origWriter = this.createResponseWriter(context);
+            // QUESTION: should we use bufferSize? Or, since the
+            // StateWriter usually only needs a small bit at the end,
+            // should we always use a much smaller size?
+            stateWriter = new StateWriter(origWriter, this.bufferSize != -1 ? this.bufferSize : 1024);
+
+            ResponseWriter writer = origWriter.cloneWithWriter(stateWriter);
+            context.setResponseWriter(writer);
+
+            // force creation of session if saving state there
+            StateManager stateMgr = context.getApplication().getStateManager();
+            if (!stateMgr.isSavingStateInClient(context))
+            {
+                context.getExternalContext().getSession(true);
+            }
+
+            long time = System.currentTimeMillis();
+
+            // render the view to the response
+            writer.startDocument();
+            if (FacesAPI.getVersion() >= 12)
+            {
+                viewToRender.encodeAll(context);
+            }
+            else
+            {
+                ComponentSupport.encodeRecursive(context, viewToRender);
+            }
+            writer.endDocument();
+
+            // finish writing
+            writer.close();
+
+            // remove transients for older versions
+            if (FacesAPI.getVersion() < 12)
+            {
+                ComponentSupport.removeTransient(viewToRender);
+            }
+
+            boolean writtenState = stateWriter.isStateWritten();
+            // flush to origWriter
+            if (writtenState)
+            {
+                String content = stateWriter.getAndResetBuffer();
+                int end = content.indexOf(STATE_KEY);
+                // See if we can find any trace of the saved state.
+                // If so, we need to perform token replacement
+                if (end >= 0)
+                {
+                    // save state
+                    Object stateObj = stateMgr.saveSerializedView(context);
+                    String stateStr;
+                    if (stateObj == null)
+                    {
+                        stateStr = null;
+                    }
+                    else
+                    {
+                        stateMgr.writeState(context, (StateManager.SerializedView) stateObj);
+                        stateStr = stateWriter.getAndResetBuffer();
+                    }
+
+                    int start = 0;
+
+                    while (end != -1)
+                    {
+                        origWriter.write(content, start, end - start);
+                        if (stateStr != null)
+                        {
+                            origWriter.write(stateStr);
+                        }
+                        start = end + STATE_KEY_LEN;
+                        end = content.indexOf(STATE_KEY, start);
+                    }
+                    origWriter.write(content, start, content.length() - start);
+                    // No trace of any saved state, so we just need to flush
+                    // the buffer
+                }
+                else
+                {
+                    origWriter.write(content);
+                    // But for JSF 1.1 (actually, just 1.1_01 RI), if we didn't
+                    // detect any saved state, force a call to
+                    // saveSerializedView() in case we're using the old
+                    // pure-server-side state saving
+                    if ((FacesAPI.getVersion() < 12) && !stateMgr.isSavingStateInClient(context))
+                    {
+                        stateMgr.saveSerializedView(context);
+                    }
+                }
+            }
+
+            time = System.currentTimeMillis() - time;
+            if (log.isLoggable(Level.FINE))
+            {
+                log.fine("Took " + time + "ms to render view: " + viewToRender.getViewId());
+            }
+
+        }
+        catch (FileNotFoundException fnfe)
+        {
+            this.handleFaceletNotFound(context, viewToRender.getViewId());
+        }
+        catch (Exception e)
+        {
+            this.handleRenderException(context, e);
+        }
+        finally
+        {
+            if (stateWriter != null)
+                stateWriter.release();
+        }
+    }
+
+    protected void handleRenderException(FacesContext context, Exception e) throws IOException, ELException,
+            FacesException
+    {
+        Object resp = context.getExternalContext().getResponse();
+
+        // always log
+        if (log.isLoggable(Level.SEVERE))
+        {
+            UIViewRoot root = context.getViewRoot();
+            StringBuffer sb = new StringBuffer(64);
+            sb.append("Error Rendering View");
+            if (root != null)
+            {
+                sb.append('[');
+                sb.append(root.getViewId());
+                sb.append(']');
+            }
+            log.log(Level.SEVERE, sb.toString(), e);
+        }
+
+        // handle dev response
+        if (this.developmentMode && !context.getResponseComplete() && resp instanceof HttpServletResponse)
+        {
+            HttpServletResponse httpResp = (HttpServletResponse) resp;
+            if (!httpResp.isCommitted())
+            {
+                httpResp.reset();
+                httpResp.setContentType("text/html; charset=UTF-8");
+                Writer w = httpResp.getWriter();
+                DevTools.debugHtml(w, context, e);
+                w.flush();
+                context.responseComplete();
+            }
+        }
+        else if (e instanceof RuntimeException)
+        {
+            throw (RuntimeException) e;
+        }
+        else if (e instanceof IOException)
+        {
+            throw (IOException) e;
+        }
+        else
+        {
+            throw new FacesException(e.getMessage(), e);
+        }
+    }
+
+    protected void handleFaceletNotFound(FacesContext context, String viewId) throws FacesException, IOException
+    {
+        String actualId = this.getActionURL(context, viewId);
+        Object respObj = context.getExternalContext().getResponse();
+        if (respObj instanceof HttpServletResponse)
+        {
+            HttpServletResponse respHttp = (HttpServletResponse) respObj;
+            respHttp.sendError(HttpServletResponse.SC_NOT_FOUND, actualId);
+            context.responseComplete();
+        }
+    }
+
+    /**
+     * Determine if Facelets needs to handle this request.
+     */
+    private boolean handledByFacelets(String viewId)
+    {
+        // If there's no extensions array or prefixes array, then
+        // just make Facelets handle everything
+        if ((extensionsArray == null) && (prefixesArray == null))
+        {
+            return true;
+        }
+
+        if (extensionsArray != null)
+        {
+            for (int i = 0; i < extensionsArray.length; i++)
+            {
+                String extension = extensionsArray[i];
+                if (viewId.endsWith(extension))
+                {
+                    return true;
+                }
+            }
+        }
+
+        if (prefixesArray != null)
+        {
+            for (int i = 0; i < prefixesArray.length; i++)
+            {
+                String prefix = prefixesArray[i];
+                if (viewId.startsWith(prefix))
+                {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    public String getDefaultSuffix(FacesContext context) throws FacesException
+    {
+        if (this.defaultSuffix == null)
+        {
+            ExternalContext extCtx = context.getExternalContext();
+            String viewSuffix = extCtx.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
+            this.defaultSuffix = (viewSuffix != null) ? viewSuffix : ViewHandler.DEFAULT_SUFFIX;
+        }
+        return this.defaultSuffix;
+    }
+
+    protected String getRenderedViewId(FacesContext context, String actionId)
+    {
+        ExternalContext extCtx = context.getExternalContext();
+        String viewId = actionId;
+        if (extCtx.getRequestPathInfo() == null)
+        {
+            String viewSuffix = this.getDefaultSuffix(context);
+            viewId = new StringBuffer(viewId).replace(viewId.lastIndexOf('.'), viewId.length(), viewSuffix).toString();
+        }
+        if (log.isLoggable(Level.FINE))
+        {
+            log.fine("ActionId -> ViewId: " + actionId + " -> " + viewId);
+        }
+        return viewId;
+    }
+
+    public void writeState(FacesContext context) throws IOException
+    {
+        if (handledByFacelets(context.getViewRoot().getViewId()))
+        {
+            // Tell the StateWriter that we're about to write state
+            StateWriter.getCurrentInstance().writingState();
+            // Write the STATE_KEY out. Unfortunately, this will
+            // be wasteful for pure server-side state managers where nothing
+            // is actually written into the output, but this cannot
+            // programatically be discovered
+            context.getResponseWriter().write(STATE_KEY);
+        }
+        else
+        {
+            this.parent.writeState(context);
+        }
+    }
+
+    public Locale calculateLocale(FacesContext context)
+    {
+        return this.parent.calculateLocale(context);
+    }
+
+    public String calculateRenderKitId(FacesContext context)
+    {
+        return this.parent.calculateRenderKitId(context);
+    }
+
+    public UIViewRoot createView(FacesContext context, String viewId)
+    {
+        if (UIDebug.debugRequest(context))
+        {
+            return new UIViewRoot();
+        }
+        return this.parent.createView(context, viewId);
+    }
+
+    public String getActionURL(FacesContext context, String viewId)
+    {
+        return this.parent.getActionURL(context, viewId);
+    }
+
+    public String getResourceURL(FacesContext context, String path)
+    {
+        return this.parent.getResourceURL(context, path);
+    }
+
+    /**
+     * Try to guess if this is a postback request. In JSF 1.2, this method is not needed, since ResponseStateManager can
+     * identify postbacks. We use a simple heuristic: for HttpServletRequests, "POST" and "PUT" are postbacks. For
+     * anything that isn't an HttpServletRequest, just guess that if there's a request parameter, it's probably a
+     * postback.
+     */
+    static private boolean isPostback11(FacesContext context)
+    {
+        Object reqObject = context.getExternalContext().getRequest();
+        if (reqObject instanceof HttpServletRequest)
+        {
+            HttpServletRequest request = (HttpServletRequest) reqObject;
+
+            String method = request.getMethod();
+
+            // Is this a POST or PUT request?
+            if ("POST".equals(method) || "PUT".equals(method))
+            {
+                return true;
+            }
+
+            return false;
+        }
+        else
+        {
+            Map paramMap = context.getExternalContext().getRequestParameterMap();
+            return !paramMap.isEmpty();
+        }
+    }
+
+    protected static class NullWriter extends Writer
+    {
+
+        static final NullWriter Instance = new NullWriter();
+
+        public void write(char[] buffer)
+        {
+        }
+
+        public void write(char[] buffer, int off, int len)
+        {
+        }
+
+        public void write(String str)
+        {
+        }
+
+        public void write(int c)
+        {
+        }
+
+        public void write(String str, int off, int len)
+        {
+        }
+
+        public void close()
+        {
+        }
+
+        public void flush()
+        {
+        }
+    }
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/StateWriter.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/StateWriter.java?rev=740940&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/StateWriter.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/StateWriter.java Wed Feb  4 23:55:25 2009
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package com.sun.facelets;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import com.sun.facelets.util.FastWriter;
+
+/**
+ * A class for handling state insertion. Content is written directly to "out" until an attempt to write state; at that
+ * point, it's redirected into a buffer that can be picked through in theory, this buffer should be very small, since it
+ * only needs to be enough to contain all the content after the close of the first (and, hopefully, only) form.
+ * <p>
+ * Potential optimizations:
+ * <ul>
+ * <li>If we created a new FastWriter at each call to writingState(), and stored a List of them, then we'd know that
+ * state tokens could only possibly be near the start of each buffer (and might not be there at all). (There might be a
+ * close-element before the state token). Then, we'd only need to check the start of the buffer for the state token; if
+ * it's there, write out the real state, then blast the rest of the buffer out. This wouldn't even require toString(),
+ * which for large buffers is expensive. However, this optimization is only going to be especially meaningful for the
+ * multi-form case.</li>
+ * <li>More of a FastWriter optimization than a StateWriter, but: it is far faster to create a set of small 1K buffers
+ * than constantly reallocating one big buffer.</li>
+ * </ul>
+ * 
+ * @author Adam Winer
+ * @version $Id: StateWriter.java,v 1.2 2008/07/13 19:01:40 rlubke Exp $
+ */
+final class StateWriter extends Writer
+{
+
+    private int initialSize;
+    private Writer out;
+    private FastWriter fast;
+    private boolean writtenState;
+
+    static public StateWriter getCurrentInstance()
+    {
+        return (StateWriter) CURRENT_WRITER.get();
+    }
+
+    public StateWriter(Writer initialOut, int initialSize)
+    {
+        if (initialSize < 0)
+        {
+            throw new IllegalArgumentException("Initial Size cannot be less than 0");
+        }
+
+        this.initialSize = initialSize;
+        this.out = initialOut;
+
+        CURRENT_WRITER.set(this);
+    }
+
+    /**
+     * Mark that state is about to be written. Contrary to what you'd expect, we cannot and should not assume that this
+     * location is really going to have state; it is perfectly legit to have a ResponseWriter that filters out content,
+     * and ignores an attempt to write out state at this point. So, we have to check after the fact to see if there
+     * really are state markers.
+     */
+    public void writingState()
+    {
+        if (!this.writtenState)
+        {
+            this.writtenState = true;
+            this.out = this.fast = new FastWriter(this.initialSize);
+        }
+    }
+
+    public boolean isStateWritten()
+    {
+        return this.writtenState;
+    }
+
+    public void close() throws IOException
+    {
+        // do nothing
+    }
+
+    public void flush() throws IOException
+    {
+        // do nothing
+    }
+
+    public void write(char[] cbuf, int off, int len) throws IOException
+    {
+        this.out.write(cbuf, off, len);
+    }
+
+    public void write(char[] cbuf) throws IOException
+    {
+        this.out.write(cbuf);
+    }
+
+    public void write(int c) throws IOException
+    {
+        this.out.write(c);
+    }
+
+    public void write(String str, int off, int len) throws IOException
+    {
+        this.out.write(str, off, len);
+    }
+
+    public void write(String str) throws IOException
+    {
+        this.out.write(str);
+    }
+
+    public String getAndResetBuffer()
+    {
+        if (!this.writtenState)
+        {
+            throw new IllegalStateException("Did not write state;  no buffer is available");
+        }
+
+        String result = this.fast.toString();
+        this.fast.reset();
+        return result;
+    }
+
+    public void release()
+    {
+        CURRENT_WRITER.set(null);
+    }
+
+    static private final ThreadLocal CURRENT_WRITER = new ThreadLocal();
+}
\ No newline at end of file

Added: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/TemplateClient.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/TemplateClient.java?rev=740940&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/TemplateClient.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/TemplateClient.java Wed Feb  4 23:55:25 2009
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package com.sun.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.webapp.pdl.facelets.FaceletContext;
+import javax.faces.webapp.pdl.facelets.FaceletException;
+
+/**
+ * FaceletHandlers can implement this contract and push themselves into the FaceletContext for participating in
+ * templating. Templates will attempt to resolve content for a specified name until one of the TemplatClients return
+ * 'true'.
+ * 
+ * @author Jacob Hookom
+ * @version $Id: TemplateClient.java,v 1.3 2008/07/13 19:01:39 rlubke Exp $
+ */
+public interface TemplateClient
+{
+
+    /**
+     * This contract is much like the normal FaceletHandler.apply method, but it takes in an optional String name which
+     * tells this instance what fragment/definition it's looking for. If you are a match, apply your logic to the passed
+     * UIComponent and return true, otherwise do nothing and return false.
+     * 
+     * @param ctx
+     *            the FaceletContext of <i>your</i> instance, not the templates'
+     * @param parent
+     *            current UIComponent instance to be applied
+     * @param name
+     *            the String name or null if the whole body should be included
+     * @return true if this client matched/applied the definition for the passed name
+     * @throws IOException
+     * @throws FacesException
+     * @throws FaceletException
+     * @throws ELException
+     */
+    public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException, FacesException,
+            FaceletException, ELException;;
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AbstractUIHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AbstractUIHandler.java?rev=740940&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AbstractUIHandler.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AbstractUIHandler.java Wed Feb  4 23:55:25 2009
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+package com.sun.facelets.compiler;
+
+import javax.faces.component.UIComponent;
+
+import javax.faces.webapp.pdl.facelets.FaceletContext;
+import javax.faces.webapp.pdl.facelets.FaceletHandler;
+import com.sun.facelets.tag.TextHandler;
+import com.sun.facelets.tag.jsf.core.FacetHandler;
+
+public abstract class AbstractUIHandler implements FaceletHandler, TextHandler
+{
+
+    public void addComponent(FaceletContext ctx, UIComponent parent, UIComponent c)
+    {
+        // possible facet scoped
+        String facetName = this.getFacetName(ctx, parent);
+        if (facetName == null)
+        {
+            parent.getChildren().add(c);
+        }
+        else
+        {
+            parent.getFacets().put(facetName, c);
+        }
+    }
+
+    protected final String getFacetName(FaceletContext ctx, UIComponent parent)
+    {
+        return (String) parent.getAttributes().get(FacetHandler.KEY);
+    }
+
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AttributeInstruction.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AttributeInstruction.java?rev=740940&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AttributeInstruction.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/AttributeInstruction.java Wed Feb  4 23:55:25 2009
@@ -0,0 +1,80 @@
+/**
+ * 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.
+ */
+
+package com.sun.facelets.compiler;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ExpressionFactory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import com.sun.facelets.el.ELAdaptor;
+import com.sun.facelets.el.ELText;
+
+final class AttributeInstruction implements Instruction
+{
+    private final String alias;
+
+    private final String attr;
+
+    private final ELText txt;
+
+    public AttributeInstruction(String alias, String attr, ELText txt)
+    {
+        this.alias = alias;
+        this.attr = attr;
+        this.txt = txt;
+    }
+
+    public void write(FacesContext context) throws IOException
+    {
+        ResponseWriter out = context.getResponseWriter();
+        try
+        {
+            ELContext elContext = ELAdaptor.getELContext(context);
+            String val = txt.toString(elContext);
+
+            out.writeAttribute(attr, val, null);
+        }
+        catch (ELException e)
+        {
+            throw new ELException(this.alias + ": " + e.getMessage(), e.getCause());
+        }
+        catch (Exception e)
+        {
+            throw new ELException(this.alias + ": " + e.getMessage(), e);
+        }
+    }
+
+    public Instruction apply(ExpressionFactory factory, ELContext ctx)
+    {
+        ELText nt = this.txt.apply(factory, ctx);
+        if (nt == this.txt)
+        {
+            return this;
+        }
+
+        return new AttributeInstruction(alias, attr, nt);
+    }
+
+    public boolean isLiteral()
+    {
+        return txt.isLiteral();
+    }
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/CommentInstruction.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/CommentInstruction.java?rev=740940&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/CommentInstruction.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/com/sun/facelets/compiler/CommentInstruction.java Wed Feb  4 23:55:25 2009
@@ -0,0 +1,54 @@
+/**
+ * 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.
+ */
+
+package com.sun.facelets.compiler;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import com.sun.facelets.el.ELAdaptor;
+import com.sun.facelets.el.ELText;
+
+final class CommentInstruction implements Instruction
+{
+    private final ELText text;
+
+    public CommentInstruction(ELText text)
+    {
+        this.text = text;
+    }
+
+    public void write(FacesContext context) throws IOException
+    {
+        ELContext elContext = ELAdaptor.getELContext(context);
+        context.getResponseWriter().writeComment(this.text.toString(elContext));
+    }
+
+    public Instruction apply(ExpressionFactory factory, ELContext ctx)
+    {
+        ELText t = this.text.apply(factory, ctx);
+        return new CommentInstruction(t);
+    }
+
+    public boolean isLiteral()
+    {
+        return false;
+    }
+}



Mime
View raw message