You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/10/07 19:35:01 UTC

svn commit: r582656 [4/39] - in /myfaces/trinidad/branches/1.2.3-branch: ./ trinidad-api/ trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ trinidad-api/src/main/jav...

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/conf/META-INF/tr-base.tld
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/conf/META-INF/tr-base.tld?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/conf/META-INF/tr-base.tld (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/conf/META-INF/tr-base.tld Sun Oct  7 10:34:29 2007
@@ -1,346 +1,291 @@
-<?xml version = "1.0" ?>
-<!--
-    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.
-	   
--->
-<!DOCTYPE taglib 
-   PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
-          "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
-<taglib>
-  <tlib-version>11-m3</tlib-version>
-  <jsp-version>1.2</jsp-version>
-  <short-name>tr</short-name>
-  <uri>http://myfaces.apache.org/trinidad</uri>
-  <display-name>Apache Trinidad Core</display-name>
-  <listener>
-    <listener-class>org.apache.myfaces.trinidadinternal.webapp.TrinidadListenerImpl</listener-class>
-  </listener>
-        
-    <tag>
-      <name>attribute</name>   
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.AttributeTag</tag-class>
-      <body-content>empty</body-content>
-      <description>
-        The Attribute tag adds a property with the specified name and value 
-        to the component associated with the parent tag.  It behaves the same
-        as the JSF Attribute tag except that it creates a value binding for 
-        expressions instead of immediately evaluating it.  
-      </description>
-      <attribute>
-        <name>name</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the name of the attribute
-        </description>
-      </attribute>
-      <attribute>
-        <name>value</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the value of the attribute
-        </description>
-      </attribute>
-    </tag>
-    
-
-    <tag>
-      <name>validator</name>   
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.ValidatorTag</tag-class>
-      <body-content>empty</body-content>
-      <description>
-        The Validator tag adds a new validator instance to the component
-        associated with the parent tag. The new validator instance is found
-        by evaluating a binding expression, or looking up a validator ID.
-        This implements the JSF 1.2 definition of &lt;f:validator&gt;.
-      </description>
-      <attribute>
-        <name>validatorId</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the ID of a validator instance registered in faces-config.xml
-        </description>
-      </attribute>
-      <attribute>
-        <name>binding</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the value binding expression to a property that returns a
-          ValidatorInstance.
-        </description>
-      </attribute>
-    </tag>        
-
-   <tag>
-      <name>forEach</name>
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.ForEachTag</tag-class>
-      <description>
-The forEach tag is a replacement for the JSTL &amp;lt;c:forEach&amp;gt; tag
-                that works with Apache Trinidad components.  Today, &amp;lt;c:forEach&amp;gt; cannot
-                be used with any JSF components or tags.  This tag brings that functionality
-        to JSF, but it is limited to Apache Trinidad tags. This tag also has several limitations not found in &amp;lt;c:forEach&amp;gt;:
-        &lt;ul&gt;
-        &lt;li&gt;&amp;lt;tr:forEach&amp;gt; does not currently support scenarios where the size of the "items" list or array changes from one request to the next. It may be possible to work around this in specific scenarios by manually deleting all children of the parent component (&amp;lt;tr:selectOneListbox&amp;gt; in the above example), but this has not yet been tested.&lt;/li&gt;
-        &lt;li&gt;&amp;lt;tr:forEach&amp;gt; does not support arbitrary java.util.Collections; it can only iterate over java.util.Lists or arrays.&lt;/li&gt;
-        &lt;li&gt;&amp;lt;tr:forEach&amp;gt; executes at the time the JSP tag executes. So it 
-        does not have access to any EL variables that are created by JSF components.
-        For example, the &amp;lt;tr:table&amp;gt; creates an EL variable using the value of
-        the "var" attribute. However, this EL variable is not available 
-to &amp;lt;tr:forEach&amp;gt;     
-        &lt;/li&gt;
-        &lt;/ul&gt;
-      </description>
-
-      <attribute>
-        <name>items</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the items over which iteration takes place 
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>var</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the name of the variable to expose
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>varStatus</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          Name of the exported scoped variable for the
-          status of the iteration.
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>begin</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the beginning index 
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>end</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the ending index 
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>step</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the number of steps per iteration
-        </description>
-      </attribute>
-
-   </tag>
-
-   <tag>
-      <name>setActionListener</name>
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.listener.SetActionListenerTag</tag-class>
-      <body-content>empty</body-content>
-      <description>
-        The setActionListener tag provides a declarative syntax for assigning values before an action fires
-      </description>
-
-      <attribute>
-        <name>to</name>
-        <required>true</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the target for the value;  must be an EL expression
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>from</name>
-        <required>true</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the source of the value;  can be an EL expression or a constant value
-        </description>
-      </attribute>
-   </tag>
-
-
-   <tag>
-      <name>fileDownloadActionListener</name>
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.listener.FileDownloadActionListenerTag</tag-class>
-      <body-content>empty</body-content>
-      <description>
-        The fileDownloadActionListener tag provides a declarative syntax for downloading files to a user from a command component.
-      </description>
-
-      <attribute>
-        <name>contentType</name>
-        <required>false</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the content or mime type of the file - e.g., text/html or application/pdf
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>filename</name>
-        <required>false</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the desired or proposed filename.  If set, the user will typically be presented with a "Save File" dialog, though this is ultimately at the descretion of the user agent.
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>method</name>
-        <required>true</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          an EL binding to the method that will deliver the file contents.  The method must take two parameters, a FacesContext and an OutputStream.
-        </description>
-      </attribute>
-   </tag>
-
-
-   <tag>
-      <name>returnActionListener</name>
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.listener.ReturnActionListenerTag</tag-class>
-      <body-content>empty</body-content>
-      <description>
-        The returnActionListener tag is a declarative way to allow an action source to return 
-        a value from a dialog or process.
-      </description>
-
-      <attribute>
-        <name>value</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          The value to return as the dialog/process result.
-          This can be an EL expression or a constant value.
-        </description>
-      </attribute>
-   </tag>
-
-
-   <tag>
-      <name>resetActionListener</name>
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.listener.ResetActionListenerTag</tag-class>
-      <body-content>empty</body-content>
-      <description>
-        The resetActionListener tag provides a declarative syntax for resetting values before an action fires
-      </description>
-   </tag>
- 
-   <tag>
-      <name>componentRef</name>
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.ComponentRefTag</tag-class>
-      <description> 
-
-      The componentRef tag adds declarative components onto the current
-      component tree. The declarative component is usually defined in a jsp
-      file.  It is currently experimental and should not be used by
-      developers.
-
-      </description>
-
-      <attribute>
-        <name>componentType</name>
-        <required>true</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-Identifies which declarative component to use. 
-All the available components must be
-declared in a region-metadata.xml file.
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>id</name>
-        <required>true</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          This ID must be unique within this page. 
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>value</name>
-        <required>false</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          A value to pass to the component definition.
-        </description>
-      </attribute>
-
-      <attribute>
-        <name>rendered</name>
-        <required>false</required>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          Whether or not this component is rendered.
-        </description>
-      </attribute>
-
-   </tag>
-
-
-    <tag>
-      <name>componentDef</name>   
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.ComponentDefTag</tag-class>
-      <description>
-        The componentDef tag is used to define a component. Its primary purpose
-is defining a "var" property so that the definition can refer to attributes
-on this component's usage.
-      </description>
-      <attribute>
-        <name>var</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the variable name to use when referencing attributes, that may be set
-          on this new component.
-        </description>
-      </attribute>
-    </tag>        
-
-
-    <tag>
-      <name>facetRef</name>   
-      <tag-class>org.apache.myfaces.trinidadinternal.taglib.FacetRefTag</tag-class>
-      <description>
-        The facetRef tag is used to copy facets from a component
-        and paste them into its
-        definition. This tag may only be used within an &lt;tr:componentDef&gt;
-        tag.
-        Each facet may be used only once within each 
-        &lt;tr:componentDef&gt;. In other words, a single facet cannot be
-        used more than once.
-      </description>
-      <attribute>
-        <name>facetName</name>
-        <rtexprvalue>false</rtexprvalue>
-        <description>
-          the facet name to copy
-        </description>
-      </attribute>
-    </tag>        
-
-</taglib>
+<?xml version = "1.0" ?>
+<!--
+    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.
+	   
+-->
+<taglib
+  xmlns="http://java.sun.com/xml/ns/javaee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+  version="2.1">
+
+  <display-name>Apache Trinidad Core</display-name>    
+  <tlib-version>1.2.2</tlib-version>
+  <short-name>tr</short-name>
+  <uri>http://myfaces.apache.org/trinidad</uri>
+  <listener>
+    <listener-class>org.apache.myfaces.trinidadinternal.webapp.TrinidadListenerImpl</listener-class>
+  </listener>
+
+   <tag>
+      <description>
+The forEach tag is a replacement for the JSTL &amp;lt;c:forEach&amp;gt; tag. 
+As of JSF 1.2/JSP 2.1/JSTL 1.2, the regular &amp;lt;c:forEach&amp;gt; tag
+does work with JSF components.  However, it does not support varStatus
+with JSF!  (Unlike c:forEach, tr:forEach doesn't currently support anything
+for "items" other than arrays and lists.)
+      </description>
+      <name>forEach</name>
+      <tag-class>org.apache.myfaces.trinidadinternal.taglib.ForEachTag</tag-class>
+      <body-content>JSP</body-content>
+
+      <attribute>
+        <description>
+          the items over which iteration takes place 
+        </description>
+        <name>items</name>
+        <deferred-value/>
+      </attribute>
+
+      <attribute>
+        <description>
+          the name of the variable to expose
+        </description>
+        <name>var</name>
+        <rtexprvalue>false</rtexprvalue>
+      </attribute>
+
+      <attribute>
+        <description>
+          Name of the exported scoped variable for the
+          status of the iteration.
+        </description>
+        <name>varStatus</name>
+        <rtexprvalue>false</rtexprvalue>
+      </attribute>
+
+      <attribute>
+        <description>
+          the beginning index 
+        </description>
+        <name>begin</name>
+        <deferred-value>
+          <type>java.lang.Integer</type>
+        </deferred-value>
+      </attribute>
+
+      <attribute>
+        <description>
+          the ending index 
+        </description>
+        <name>end</name>
+        <deferred-value>
+          <type>java.lang.Integer</type>
+        </deferred-value>
+      </attribute>
+
+      <attribute>
+        <description>
+          the number of steps per iteration
+        </description>
+        <name>step</name>
+        <deferred-value>
+          <type>java.lang.Integer</type>
+        </deferred-value>
+      </attribute>
+
+   </tag>
+
+   <tag>
+      <description>
+        The setActionListener tag provides a declarative syntax for assigning values before an action fires
+      </description>
+
+      <name>setActionListener</name>
+      <tag-class>org.apache.myfaces.trinidadinternal.taglib.listener.SetActionListenerTag</tag-class>
+      <body-content>empty</body-content>
+      <attribute>
+        <description>
+          the target for the value;  must be an EL expression
+        </description>
+        <name>to</name>
+        <required>true</required>
+        <deferred-value/>
+      </attribute>
+
+      <attribute>
+        <description>
+          the source of the value;  can be an EL expression or a constant value
+        </description>
+        <name>from</name>
+        <required>true</required>
+        <deferred-value/>
+      </attribute>
+   </tag>
+
+   <tag>
+      <name>fileDownloadActionListener</name>
+      <tag-class>org.apache.myfaces.trinidadinternal.taglib.listener.FileDownloadActionListenerTag</tag-class>
+      <body-content>empty</body-content>
+      <description>
+        The fileDownloadActionListener tag provides a declarative syntax for downloading files to a user from a command component.
+      </description>
+
+      <attribute>
+        <description>
+          the content or mime type of the file - e.g., text/html or application/pdf
+        </description>
+        <name>contentType</name>
+        <deferred-value/>
+      </attribute>
+
+      <attribute>
+        <description>
+          the desired or proposed filename.  If set, the user will typically be presented with a "Save File" dialog, though this is ultimately at the descretion of the user agent.
+        </description>
+        <name>filename</name>
+        <deferred-value/>
+      </attribute>
+
+      <attribute>
+        <description>
+          an EL binding to the method that will deliver the file contents.  The method must take two parameters, a FacesContext and an OutputStream.
+        </description>
+        <name>method</name>
+        <required>true</required>
+        <deferred-method>
+          <method-signature>void myMethod(javax.faces.context.FacesContext, java.io.OutputStream)</method-signature>
+        </deferred-method>
+      </attribute>
+   </tag>
+
+   <tag>
+      <description>
+        The returnActionListener tag is a declarative way to allow an action source to return 
+        a value from a dialog or process.
+      </description>
+      <name>returnActionListener</name>
+      <tag-class>org.apache.myfaces.trinidadinternal.taglib.listener.ReturnActionListenerTag</tag-class>
+      <body-content>empty</body-content>
+
+      <attribute>
+        <description>
+          The value to return as the dialog/process result.
+          This can be an EL expression or a constant value.
+        </description>
+        <name>value</name>
+        <deferred-value/>
+      </attribute>
+   </tag>
+
+
+   <tag>
+      <description>
+        The resetActionListener tag provides a declarative syntax for resetting values before an action fires
+      </description>
+      <name>resetActionListener</name>
+      <tag-class>org.apache.myfaces.trinidadinternal.taglib.listener.ResetActionListenerTag</tag-class>
+      <body-content>empty</body-content>
+   </tag>
+ 
+   <tag>
+      <description> 
+
+      The componentRef tag adds declarative components onto the current
+      component tree. The declarative component is usually defined in a jsp
+      file.  It is currently experimental and should not be used by
+      developers.
+
+      </description>
+
+      <name>componentRef</name>
+      <tag-class>org.apache.myfaces.trinidadinternal.taglib.ComponentRefTag</tag-class>
+      <body-content>JSP</body-content>
+      <attribute>
+        <description>
+Identifies which declarative component to use. 
+All the available components must be
+declared in a region-metadata.xml file.
+        </description>
+        <name>componentType</name>
+        <required>true</required>
+        <deferred-value/>
+      </attribute>
+
+      <attribute>
+        <description>
+          This ID must be unique within this page. 
+        </description>
+        <name>id</name>
+        <required>true</required>
+      </attribute>
+
+      <attribute>
+        <description>
+          A value to pass to the component definition.
+        </description>
+        <name>value</name>
+        <required>false</required>
+        <deferred-value/>
+      </attribute>
+
+      <attribute>
+        <description>
+          Whether or not this component is rendered.
+        </description>
+        <name>rendered</name>
+        <required>false</required>
+        <deferred-value/>
+      </attribute>
+
+   </tag>
+
+
+    <tag>
+      <description>
+        The componentDef tag is used to define a component. Its primary purpose
+is defining a "var" property so that the definition can refer to attributes
+on this component's usage.
+      </description>
+      <name>componentDef</name>   
+      <tag-class>org.apache.myfaces.trinidadinternal.taglib.ComponentDefTag</tag-class>
+      <body-content>JSP</body-content>
+      <attribute>
+        <description>
+          the variable name to use when referencing attributes, that may be set
+          on this new component.
+        </description>
+        <name>var</name>
+        <rtexprvalue>false</rtexprvalue>
+      </attribute>
+    </tag>        
+
+
+    <tag>
+      <description>
+        The facetRef tag is used to copy facets from a component
+        and paste them into its
+        definition. This tag may only be used within an &lt;tr:componentDef&gt;
+        tag.
+        Each facet may be used only once within each 
+        &lt;tr:componentDef&gt;. In other words, a single facet cannot be
+        used more than once.
+      </description>
+      <name>facetRef</name>   
+      <tag-class>org.apache.myfaces.trinidadinternal.taglib.FacetRefTag</tag-class>
+      <body-content>JSP</body-content>
+      <attribute>
+        <description>
+          the facet name to copy
+        </description>
+        <name>facetName</name>
+        <rtexprvalue>false</rtexprvalue>
+      </attribute>
+    </tag>        
+
+</taglib>

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/conf/META-INF/trh-base.tld
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/conf/META-INF/trh-base.tld?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/conf/META-INF/trh-base.tld (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/conf/META-INF/trh-base.tld Sun Oct  7 10:34:29 2007
@@ -1,30 +1,30 @@
-<?xml version = "1.0" ?>
-<!--
-    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.
-	   
--->
-<!DOCTYPE taglib 
-   PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
-          "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
-<taglib>
-  <tlib-version>11-m3</tlib-version>
-  <jsp-version>1.2</jsp-version>
-  <short-name>trh</short-name>
-  <uri>http://myfaces.apache.org/trinidad/html</uri>
-  <display-name>Apache Trinidad HTML</display-name>
-</taglib>
+<?xml version = "1.0" ?>
+<!--
+    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.
+	   
+-->
+<taglib
+  xmlns="http://java.sun.com/xml/ns/javaee"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+  version="2.1">
+  <display-name>Apache Trinidad HTML</display-name>
+  <tlib-version>11-m3</tlib-version>
+  <short-name>trh</short-name>
+  <uri>http://myfaces.apache.org/trinidad/html</uri>
+</taglib>

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewHandlerImpl.java Sun Oct  7 10:34:29 2007
@@ -34,6 +34,7 @@
 
 import javax.faces.FacesException;
 import javax.faces.application.ViewHandler;
+import javax.faces.application.ViewHandlerWrapper;
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
@@ -57,10 +58,9 @@
  * @todo Rename something less generic
  * @todo Support extension mapping (*.faces)
  * @todo The modification detection only works for a single user.  That's
- *   OK for now, because it's intended for use while developing, not while
- *   deployed - yet it's on all the time.  Hrm.
+ *   OK for now, because it's intended for use while developing
  */
-public class ViewHandlerImpl extends ViewHandler
+public class ViewHandlerImpl extends ViewHandlerWrapper
 {
   static public final String ALTERNATE_VIEW_HANDLER =
     "org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER";
@@ -73,16 +73,9 @@
     _loadInternalViews();
   }
 
-  @Override
-  public Locale calculateLocale(FacesContext context)
-  {
-    return _delegate.calculateLocale(context);
-  }
-
-  @Override
-  public String calculateRenderKitId(FacesContext context)
+  protected ViewHandler getWrapped()
   {
-    return _delegate.calculateRenderKitId(context);
+    return _delegate;
   }
 
   @Override
@@ -121,13 +114,13 @@
       }
     }
 
-    return _delegate.createView(context, viewId);
+    return super.createView(context, viewId);
   }
 
   @Override
   public String getActionURL(FacesContext context, String viewId)
   {
-    String actionURL = _delegate.getActionURL(context, viewId);
+    String actionURL = super.getActionURL(context, viewId);
     RequestContext afContext = RequestContext.getCurrentInstance();
     if (afContext != null)
     {
@@ -144,7 +137,7 @@
     FacesContext context,
     String       path)
   {
-    return _delegate.getResourceURL(context, path);
+    return super.getResourceURL(context, path);
   }
 
 
@@ -179,7 +172,7 @@
         }
         else
         {
-          _delegate.renderView(context, viewToRender);
+          super.renderView(context, viewToRender);
         }
 
         if (service != null)
@@ -263,7 +256,7 @@
       return null;
     }
 
-    UIViewRoot result = _delegate.restoreView(context, viewId);
+    UIViewRoot result = super.restoreView(context, viewId);
     // If we've successfully restored a view, then assume that
     // this is a postback request.
     if (result != null)
@@ -292,7 +285,7 @@
         service.isStateless(context))
       return;
 
-    _delegate.writeState(context);
+    super.writeState(context);
   }
 
   synchronized private void _initIfNeeded(FacesContext context)

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/binding/AccessKeyBinding.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/binding/AccessKeyBinding.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/binding/AccessKeyBinding.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/binding/AccessKeyBinding.java Sun Oct  7 10:34:29 2007
@@ -18,8 +18,11 @@
  */
 package org.apache.myfaces.trinidadinternal.binding;
 
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
+import java.io.Serializable;
+
+import javax.el.ValueExpression;
+import javax.el.ELContext;
+import javax.el.PropertyNotWritableException;
 
 import org.apache.myfaces.trinidadinternal.util.nls.StringUtils;
 
@@ -29,25 +32,25 @@
  * access key.
  *
  */
-public class AccessKeyBinding extends ValueBindingAdapter
+public class AccessKeyBinding extends ValueExpression implements Serializable
 {
   /**
    * Constructor purely for serialization.
    */
   public AccessKeyBinding()
   {
-    super(null);
   }
 
-  public AccessKeyBinding(ValueBinding base)
+  public AccessKeyBinding(ValueExpression expr)
   {
-    super(base);
+    _base = expr;
   }
 
+
   @Override
-  public Object getValue(FacesContext context)
+  public Object getValue(ELContext context)
   {
-    Object o = super.getValue(context);
+    Object o = _base.getValue(context);
     if (o == null)
       return null;
 
@@ -60,8 +63,51 @@
   }
 
   @Override
-  public Class<?> getType(FacesContext context)
+  public void setValue(ELContext context, Object value)
+  {
+    throw new PropertyNotWritableException();
+  }
+
+  @Override
+  public Class<?> getType(ELContext context)
+  {
+    return Character.class;
+  }
+
+  @Override
+  public Class<?> getExpectedType()
   {
     return Character.class;
   }
+
+  @Override
+  public boolean isReadOnly(ELContext context)
+  {
+    return true;
+  }
+
+
+  @Override
+  public boolean isLiteralText()
+  {
+    return false;
+  }
+
+  @Override
+  public String getExpressionString()
+  {
+    return null;
+  }
+
+  public int hashCode()
+  {
+    return 0;
+  }
+
+  public boolean equals(Object o)
+  {
+    return (o == this);
+  }
+
+  private ValueExpression _base;
 }

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/binding/StripAccessKeyBinding.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/binding/StripAccessKeyBinding.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/binding/StripAccessKeyBinding.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/binding/StripAccessKeyBinding.java Sun Oct  7 10:34:29 2007
@@ -18,8 +18,11 @@
  */
 package org.apache.myfaces.trinidadinternal.binding;
 
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
+import java.io.Serializable;
+
+import javax.el.ValueExpression;
+import javax.el.ELContext;
+import javax.el.PropertyNotWritableException;
 
 import org.apache.myfaces.trinidadinternal.util.nls.StringUtils;
 
@@ -29,25 +32,18 @@
  * the mnemonic.
  *
  */
-public class StripAccessKeyBinding extends ValueBindingAdapter
+public class StripAccessKeyBinding extends ValueExpression implements Serializable
 {
-  /**
-   * Constructor purely for serialization.
-   */
-  public StripAccessKeyBinding()
-  {
-    super(null);
-  }
 
-  public StripAccessKeyBinding(ValueBinding base)
+  public StripAccessKeyBinding(ValueExpression base)
   {
-    super(base);
+    _base = base;
   }
 
   @Override
-  public Object getValue(FacesContext context)
+  public Object getValue(ELContext context)
   {
-    Object o = super.getValue(context);
+    Object o = _base.getValue(context);
     if (o == null)
       return null;
 
@@ -60,8 +56,50 @@
   }
 
   @Override
-  public Class<?> getType(FacesContext context)
+  public void setValue(ELContext context, Object value)
+  {
+    throw new PropertyNotWritableException();
+  }
+
+  @Override
+  public Class<?> getType(ELContext context)
+  {
+    return Character.class;
+  }
+
+  @Override
+  public Class<?> getExpectedType()
+  {
+    return Character.class;
+  }
+
+  @Override
+  public boolean isReadOnly(ELContext context)
   {
-    return String.class;
+    return true;
   }
+
+  @Override
+  public boolean isLiteralText()
+  {
+    return false;
+  }
+
+  @Override
+  public String getExpressionString()
+  {
+    return null;
+  }
+
+  public int hashCode()
+  {
+    return 0;
+  }
+
+  public boolean equals(Object o)
+  {
+    return (o == this);
+  }
+
+  private ValueExpression _base;
 }

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/ConfigParser.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/ConfigParser.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/ConfigParser.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/ConfigParser.java Sun Oct  7 10:34:29 2007
@@ -24,6 +24,8 @@
 import java.util.Map;
 import java.util.TimeZone;
 
+import javax.el.ValueExpression;
+
 import javax.faces.context.ExternalContext;
 import javax.faces.el.ValueBinding;
 import javax.xml.parsers.ParserConfigurationException;
@@ -195,9 +197,10 @@
             }
             else
             {
-              ValueBinding binding =
-                LazyValueBinding.createValueBinding(currentText);
-              _bean.setValueBinding(key, binding);
+              ValueExpression expression =
+                LazyValueExpression.createValueExpression(_currentText, 
+                                                          key.getType());
+              _bean.setValueExpression(key, expression);
             }
           }
           else

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/GlobalConfiguratorImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/GlobalConfiguratorImpl.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/GlobalConfiguratorImpl.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/GlobalConfiguratorImpl.java Sun Oct  7 10:34:29 2007
@@ -1,508 +1,722 @@
-/*
- *  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 org.apache.myfaces.trinidadinternal.config;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-
-import org.apache.myfaces.trinidad.config.Configurator;
-import org.apache.myfaces.trinidad.context.RequestContext;
-import org.apache.myfaces.trinidad.context.RequestContextFactory;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidad.skin.SkinFactory;
-import org.apache.myfaces.trinidad.util.ClassLoaderUtils;
-import org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl;
-import org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl;
-import org.apache.myfaces.trinidadinternal.skin.SkinUtils;
-import org.apache.myfaces.trinidadinternal.util.ExternalContextUtils;
-
-/**
- * This is the implementation of the Trinidad's Global configurator. It provides the entry point for
- * all other configurators. This class is responsible for enforcing the contract outlined by the
- * Configurator abstract class, but allows a more "relaxed" implementation of the APIs called for by
- * the Configurator class, making it more convenient to use ConfiguratorServices from within the
- * Trinidad renderkit. Where appropriate, these differences will be documented for the benifit of
- * the Trindad developer.
- *
- * @see org.apache.myfaces.trinidad.config.Configurator
- * @version $Revision$ $Date$
- */
-public class GlobalConfiguratorImpl extends Configurator
-{
-  /**
-   * Returns a GlobalConfigurator instance for the current context's class loader. The
-   * GlobalConfigurator is responsible for enforcing the contract on the other methods of this
-   * class. This means that if {@link #init(ExternalContext)} is called multiple times, the global
-   * configurator will call all subordinate configurators only once.
-   *
-   * Likewise, the GlobalConfigurator will return exceptions when the contract is expressly violated
-   * (like if {@link #getExternalContext(ExternalContext)} is called before a {{@link #beginRequest(ExternalContext)}.
-   *
-   * @return a GlobalConfigurator or <code>null</code> is one was unable to be obtained.
-   */
-  static public final GlobalConfiguratorImpl getInstance()
-  {
-    final ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
-    if (loader == null)
-    {
-      _LOG.severe("CANNOT_FIND_CONTEXT_CLASS_LOADER");
-    }
-    else
-    {
-      synchronized (_CONFIGURATORS)
-      {
-        GlobalConfiguratorImpl config = _CONFIGURATORS.get(loader);
-        if (config == null)
-        {
-          try
-          {
-            config = new GlobalConfiguratorImpl();
-            _CONFIGURATORS.put(loader, config);
-          }
-          catch (final RuntimeException e)
-          {
-            // OC4J was not reporting these errors properly:
-            _LOG.severe(e);
-            throw e;
-          }
-          _LOG.fine("GlobalConfigurator has been created.");
-        }
-        return config;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Returns true if the request has not been stated for the current "virtual"
-   * request.  In the servlet environment this will be true after
-   * {@link #beginRequest(ExternalContext)} is executed and before
-   * {@link #endRequest(ExternalContext)} is executed.  This will generally
-   * happen once per request.  In the Portlet Environment, the request must be
-   * be started and ended at the beginning and end of both the actionRequest
-   * and the RenderRequest.
-   *
-   * @param ec
-   * @return
-   */
-  static public boolean isRequestStarted(final ExternalContext ec)
-  {
-    return (RequestType.getType(ec) != null);
-  }
-
-  /**
-   * Returns "true" if the services should be considered enabled or disabled.
-   *
-   * @param ec
-   * @return
-   */
-  static private final boolean _isDisabled(final ExternalContext ec)
-  {
-    final Boolean inRequest = (Boolean) ec.getRequestMap().get(_IN_REQUEST);
-
-    if (inRequest == null)
-    {
-      return isConfiguratorServiceDisabled(ec);
-    }
-    else
-    {
-      final boolean disabled = inRequest.booleanValue();
-      if (disabled != isConfiguratorServiceDisabled(ec))
-      {
-        _LOG
-            .warning("Configurator services were disabled after beginRequest was executed.  Cannot disable configurator services");
-      }
-
-      return disabled;
-    }
-  }
-
-  /**
-   * Private default constructor. Right now this class is not serializable. If serialization is
-   * required, we may wish to make this public. We really don't want people using this though.
-   */
-  private GlobalConfiguratorImpl()
-  {}
-
-  /**
-   * Executes the beginRequest methods of all of the configurator services. This method will also
-   * initizlize the configurator if it has not already been initialized, so there may be no need to
-   * call the {@link #init(ExternalContext)} method directly.
-   *
-   * This method also ensures that the requestContext is attached before the beginRequest methods
-   * are called, so there is no reason to initialize the request context before calling this method.
-   * In portal environments, it is important to execute this method once for each Portlet action and
-   * render request so that the requestContext may be properly initialized even though the
-   * underlying services will be called only once per physical request.
-   *
-   * @param externalContext
-   *          the externalContext to use to begin the request.
-   *
-   * @see org.apache.myfaces.trinidad.config.Configurator#beginRequest(javax.faces.context.ExternalContext)
-   */
-  @SuppressWarnings("unchecked") // TODO: remove this for Faces 1.2
-  @Override
-  public void beginRequest(final ExternalContext externalContext)
-  {
-    // asserts for debug which disappear in production
-    assert externalContext != null;
-
-    // Do per-virtual request stuff
-    if (RequestType.getType(externalContext) == null)
-    {
-      // RequestType may change in a portal environment. Make sure it's set up to enforce the
-      // contracts
-      RequestType.setType(externalContext);
-
-      // By contract, Configurators beginRequest is only called once per physical request.
-      // The globalConfigurator may be called multiple times, however, so we need to enforce
-      // the contract.
-      if (!_isDisabled(externalContext))
-      {
-        // If this hasn't been initialized then please initialize
-        if (!_initialized)
-        {
-          init(externalContext);
-        }
-
-        _attachRequestContext(externalContext);
-
-        if (externalContext.getRequestMap().get(_IN_REQUEST) == null)
-        {
-          _startConfiguratorServiceRequest(externalContext);
-        }
-      }
-      else
-      {
-        _LOG.fine("GlobalConfigurator: Configurators have been disabled for this request.");
-      }
-    }
-    else if (!RequestType.isCorrectType(externalContext))
-    {
-      // This will happen if the actionRequest was not ended before dispatching to the render
-      // request
-      throw new IllegalStateException("The previous action request was not ended.");
-    }
-    else
-    {
-      _LOG.fine("BeginRequest called multiple times for this request");
-    }
-  }
-
-  /**
-   * Cleans up the current configurator. This will execute the destroy method on all of the
-   * configurator services. Generally this will be called by Trinidad's context listener when the
-   * context is destroyed, but it may be used manually to allow the configurator to be
-   * re-initialized.
-   *
-   * Calling this method while the configurator is not initialized will not re-execute the destroy
-   * methods on the services.
-   *
-   * @see org.apache.myfaces.trinidad.config.Configurator#destroy()
-   */
-  @Override
-  public void destroy()
-  {
-    if (_initialized)
-    {
-      for (final Configurator config : _services)
-      {
-        try
-        {
-          config.destroy();
-        }
-        catch (final Throwable t)
-        {
-          // we always want to continue to destroy things, so log errors and continue
-          _LOG.severe(t);
-        }
-      }
-      _services = null;
-      _initialized = false;
-    }
-  }
-
-  /**
-   * Ends the currently begun request. It is important to note that this should be executed only
-   * once per physical request.
-   *
-   * @see org.apache.myfaces.trinidad.config.Configurator#endRequest(javax.faces.context.ExternalContext)
-   */
-  @Override
-  public void endRequest(final ExternalContext externalContext)
-  {
-    // do per virtual-request stuff
-    if (RequestType.getType(externalContext) != null)
-    {
-      if (!_isDisabled(externalContext))
-      {
-        final RequestType type = RequestType.getType(externalContext);
-
-        // Do not end services at the end of a portal action request
-        if (type != RequestType.PORTAL_ACTION)
-        {
-          _endConfiguratorServiceRequest(externalContext);
-        }
-        
-        _releaseRequestContext(externalContext);
-      }
-      RequestType.clearType(externalContext);
-    }
-  }
-
-  /**
-   * Returns an externalContext for this configurator and all of the configurator services. If this
-   * method is executed before {@link #beginRequest(ExternalContext)} then this method will call
-   * beginRequest(). It is important to note, however, that even though beginRequest does not need
-   * to be explicitly called, {{@link #endRequest(ExternalContext)} does need to be called when the
-   * request has completed or the contract to the configurators will be broken.
-   *
-   * @param externalContext
-   *          the ExternalContext object that should be wrapped.
-   *
-   * @return a decorated ExternalContext object
-   */
-  @Override
-  public ExternalContext getExternalContext(ExternalContext externalContext)
-  {
-    if (RequestType.getType(externalContext) == null)
-    {
-      beginRequest(externalContext);
-    }
-
-    if (!_isDisabled(externalContext))
-    {
-      // Wrap ExternalContexts
-      for (final Configurator config : _services)
-      {
-        externalContext = config.getExternalContext(externalContext);
-      }
-    }
-
-    return externalContext;
-  }
-
-  /**
-   * Initializes the global configurator and the configurator services. This method need not be
-   * called directly as it will be called from {@link #beginRequest(ExternalContext)} if needed. It
-   * is also possible to execute this method more then once, although if initialization has already
-   * happened then a call to this method will not do anything. To re-initialize this class, call
-   * {@link #destroy()} first and then call this method.
-   *
-   * @param externalContext
-   *          the externalContext needed to initialize this class
-   *
-   * @see org.apache.myfaces.trinidad.config.Configurator#init(javax.faces.context.ExternalContext)
-   */
-  @Override
-  public void init(final ExternalContext externalContext)
-  {
-    assert externalContext != null;
-
-    if (!_initialized)
-    {
-      _services = ClassLoaderUtils.getServices(Configurator.class.getName());
-
-      // Create a new RequestContextFactory is needed
-      if (RequestContextFactory.getFactory() == null)
-      {
-        RequestContextFactory.setFactory(new RequestContextFactoryImpl());
-      }
-
-      // Create a new SkinFactory if needed.
-      if (SkinFactory.getFactory() == null)
-      {
-        SkinFactory.setFactory(new SkinFactoryImpl());
-      }
-
-      // register the base skins
-      SkinUtils.registerBaseSkins();
-
-      for (final Configurator config : _services)
-      {
-        config.init(externalContext);
-      }
-
-      // after the 'services' filters are initialized, then register
-      // the skin extensions found in trinidad-skins.xml. This
-      // gives a chance to the 'services' filters to create more base
-      // skins that the skins in trinidad-skins.xml can extend.
-      SkinUtils.registerSkinExtensions(externalContext);
-
-      _initialized = true;
-    }
-    else
-    {
-      _LOG.warning("CONFIGURATOR_SERVICES_INITIALIZED");
-    }
-  }
-
-  /**
-   * @param externalContext
-   * @return
-   */
-  @SuppressWarnings("unchecked")
-  private void _attachRequestContext(final ExternalContext externalContext)
-  {
-    // If someone didn't release the RequestContext on an earlier request,
-    // then it'd still be around, and trying to create a new one
-    // would trigger an exception. We don't want to take down
-    // this thread for all eternity, so clean up after poorly-behaved code.
-    RequestContext context = RequestContext.getCurrentInstance();
-    if (context != null)
-    {
-      if (_LOG.isWarning())
-      {
-        _LOG.warning("REQUESTCONTEXT_NOT_PROPERLY_RELEASED");
-      }
-      context.release();
-    }
-
-    // See if we've got a cached RequestContext instance; if so,
-    // reattach it
-    final Object cachedRequestContext = externalContext.getRequestMap().get(
-        _REQUEST_CONTEXT);
-
-    // Catch both the null scenario and the
-    // RequestContext-from-a-different-classloader scenario
-    if (cachedRequestContext instanceof RequestContext)
-    {
-      context = (RequestContext) cachedRequestContext;
-      context.attach();
-    }
-    else
-    {
-      final RequestContextFactory factory = RequestContextFactory.getFactory();
-      assert factory != null;
-      context = factory.createContext(externalContext);
-      externalContext.getRequestMap().put(_REQUEST_CONTEXT, context);
-    }
-
-    assert RequestContext.getCurrentInstance() == context;
-  }
-  
-  private void _releaseRequestContext(final ExternalContext ec)
-  {
-    //If it's not a portal action, we should remove the cached request because
-    //well want to create a new one next request
-    if(RequestType.getType(ec) != RequestType.PORTAL_ACTION)
-    {
-      ec.getRequestMap().remove(_REQUEST_CONTEXT);
-    }
-    
-    final RequestContext context = RequestContext.getCurrentInstance();
-    if (context != null)
-    {
-      context.release();
-      assert RequestContext.getCurrentInstance() == null;
-    }    
-  }
-
-  private void _endConfiguratorServiceRequest(final ExternalContext ec)
-  {
-    // Physical request has now ended
-    // Clear the in-request flag
-    ec.getRequestMap().remove(_IN_REQUEST);
-    for (final Configurator config : _services)
-    {
-      config.endRequest(ec);
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  private void _startConfiguratorServiceRequest(final ExternalContext ec)
-  {
-    // Physical request has now begun
-    final boolean disabled = isConfiguratorServiceDisabled(ec);
-
-    // Tell whether the services were disabled when the requests had begun
-    ec.getRequestMap().put(_IN_REQUEST, disabled);
-
-    // If this hasn't been initialized then please initialize
-    for (final Configurator config : _services)
-    {
-      config.beginRequest(ec);
-    }
-  }
-
-  private boolean            _initialized;
-  private List<Configurator> _services;
-  static private final Map<ClassLoader, GlobalConfiguratorImpl> _CONFIGURATORS = new HashMap<ClassLoader, GlobalConfiguratorImpl>();
-  static private final String _IN_REQUEST    = GlobalConfiguratorImpl.class
-                                                         .getName()
-                                                         + ".IN_REQUEST";
-  static private final String _REQUEST_CONTEXT = GlobalConfiguratorImpl.class.getName()
-                                                         +".REQUEST_CONTEXT";
-  static private final TrinidadLogger _LOG  = TrinidadLogger.createTrinidadLogger(GlobalConfiguratorImpl.class);
-
-  private enum RequestType
-  {
-    PORTAL_ACTION,
-    PORTAL_RENDER,
-    SERVLET;
-
-    public static void clearType(final ExternalContext ec)
-    {
-      ec.getRequestMap().remove(_REQUEST_TYPE);
-    }
-
-    public static RequestType getType(final ExternalContext ec)
-    {
-      return (RequestType) ec.getRequestMap().get(_REQUEST_TYPE);
-    }
-
-    public static boolean isCorrectType(final ExternalContext ec)
-    {
-      return _findType(ec) == getType(ec);
-    }
-
-    @SuppressWarnings("unchecked")
-    public static void setType(final ExternalContext ec)
-    {
-      ec.getRequestMap().put(_REQUEST_TYPE, _findType(ec));
-    }
-
-    private static final RequestType _findType(final ExternalContext ec)
-    {
-      if (ExternalContextUtils.isPortlet(ec))
-      {
-        if (ExternalContextUtils.isAction(ec))
-        {
-          return PORTAL_ACTION;
-        }
-        else
-        {
-          return PORTAL_RENDER;
-        }
-      }
-      else
-      {
-        return SERVLET;
-      }
-    }
-
-    static private final String _REQUEST_TYPE = GlobalConfiguratorImpl.class.getName()
-                                                  + ".REQUEST_TYPE";
-  }
-}
+/*
+ *  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 org.apache.myfaces.trinidadinternal.config;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+
+import javax.servlet.ServletRequest;
+
+import javax.servlet.ServletRequestWrapper;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.myfaces.trinidad.config.Configurator;
+import org.apache.myfaces.trinidad.context.ExternalContextDecorator;
+import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidad.context.RequestContextFactory;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidad.skin.SkinFactory;
+import org.apache.myfaces.trinidad.util.ClassLoaderUtils;
+import org.apache.myfaces.trinidadinternal.context.RequestContextFactoryImpl;
+import org.apache.myfaces.trinidadinternal.context.external.ServletCookieMap;
+import org.apache.myfaces.trinidadinternal.context.external.ServletRequestHeaderMap;
+import org.apache.myfaces.trinidadinternal.context.external.ServletRequestHeaderValuesMap;
+import org.apache.myfaces.trinidadinternal.context.external.ServletRequestMap;
+import org.apache.myfaces.trinidadinternal.context.external.ServletRequestParameterMap;
+import org.apache.myfaces.trinidadinternal.context.external.ServletRequestParameterValuesMap;
+import org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl;
+import org.apache.myfaces.trinidadinternal.skin.SkinUtils;
+import org.apache.myfaces.trinidadinternal.util.ExternalContextUtils;
+
+/**
+ * This is the implementation of the Trinidad's Global configurator. It provides the entry point for
+ * all other configurators. This class is responsible for enforcing the contract outlined by the
+ * Configurator abstract class, but allows a more "relaxed" implementation of the APIs called for by
+ * the Configurator class, making it more convenient to use ConfiguratorServices from within the
+ * Trinidad renderkit. Where appropriate, these differences will be documented for the benifit of
+ * the Trindad developer.
+ *
+ * @see org.apache.myfaces.trinidad.config.Configurator
+ * @version $Revision$ $Date$
+ */
+public class GlobalConfiguratorImpl extends Configurator
+{
+  /**
+   * Returns a GlobalConfigurator instance for the current context's class loader. The
+   * GlobalConfigurator is responsible for enforcing the contract on the other methods of this
+   * class. This means that if {@link #init(ExternalContext)} is called multiple times, the global
+   * configurator will call all subordinate configurators only once.
+   *
+   * Likewise, the GlobalConfigurator will return exceptions when the contract is expressly violated
+   * (like if {@link #getExternalContext(ExternalContext)} is called before a {{@link #beginRequest(ExternalContext)}.
+   *
+   * @return a GlobalConfigurator or <code>null</code> is one was unable to be obtained.
+   */
+  static public final GlobalConfiguratorImpl getInstance()
+  {
+    final ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+    if (loader == null)
+    {
+      _LOG.severe("CANNOT_FIND_CONTEXT_CLASS_LOADER");
+    }
+    else
+    {
+      synchronized (_CONFIGURATORS)
+      {
+        GlobalConfiguratorImpl config = _CONFIGURATORS.get(loader);
+        if (config == null)
+        {
+          try
+          {
+            config = new GlobalConfiguratorImpl();
+            _CONFIGURATORS.put(loader, config);
+          }
+          catch (final RuntimeException e)
+          {
+            // OC4J was not reporting these errors properly:
+            _LOG.severe(e);
+            throw e;
+          }
+          _LOG.fine("GlobalConfigurator has been created.");
+        }
+        return config;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * Returns true if the request has not been stated for the current "virtual"
+   * request.  In the servlet environment this will be true after
+   * {@link #beginRequest(ExternalContext)} is executed and before
+   * {@link #endRequest(ExternalContext)} is executed.  This will generally
+   * happen once per request.  In the Portlet Environment, the request must be
+   * be started and ended at the beginning and end of both the actionRequest
+   * and the RenderRequest.
+   *
+   * @param ec
+   * @return
+   */
+  static public boolean isRequestStarted(final ExternalContext ec)
+  {
+    return (RequestType.getType(ec) != null);
+  }
+
+  /**
+   * Returns "true" if the services should be considered enabled or disabled.
+   *
+   * @param ec
+   * @return
+   */
+  static private final boolean _isDisabled(final ExternalContext ec)
+  {
+    final Boolean inRequest = (Boolean) ec.getRequestMap().get(_IN_REQUEST);
+
+    if (inRequest == null)
+    {
+      return isConfiguratorServiceDisabled(ec);
+    }
+    else
+    {
+      final boolean disabled = inRequest.booleanValue();
+      if (disabled != isConfiguratorServiceDisabled(ec))
+      {
+        _LOG
+            .warning("Configurator services were disabled after beginRequest was executed.  Cannot disable configurator services");
+      }
+
+      return disabled;
+    }
+  }
+
+  /**
+   * Private default constructor. Right now this class is not serializable. If serialization is
+   * required, we may wish to make this public. We really don't want people using this though.
+   */
+  private GlobalConfiguratorImpl()
+  {}
+
+  /**
+   * Executes the beginRequest methods of all of the configurator services. This method will also
+   * initizlize the configurator if it has not already been initialized, so there may be no need to
+   * call the {@link #init(ExternalContext)} method directly.
+   *
+   * This method also ensures that the requestContext is attached before the beginRequest methods
+   * are called, so there is no reason to initialize the request context before calling this method.
+   * In portal environments, it is important to execute this method once for each Portlet action and
+   * render request so that the requestContext may be properly initialized even though the
+   * underlying services will be called only once per physical request.
+   *
+   * @param externalContext
+   *          the externalContext to use to begin the request.
+   *
+   * @see org.apache.myfaces.trinidad.config.Configurator#beginRequest(javax.faces.context.ExternalContext)
+   */
+  @SuppressWarnings("unchecked") // TODO: remove this for Faces 1.2
+  @Override
+  public void beginRequest(final ExternalContext externalContext)
+  {
+    // asserts for debug which disappear in production
+    assert externalContext != null;
+
+    // Do per-virtual request stuff
+    if (RequestType.getType(externalContext) == null)
+    {
+      // RequestType may change in a portal environment. Make sure it's set up to enforce the
+      // contracts
+      RequestType.setType(externalContext);
+
+      // By contract, Configurators beginRequest is only called once per physical request.
+      // The globalConfigurator may be called multiple times, however, so we need to enforce
+      // the contract.
+      if (!_isDisabled(externalContext))
+      {
+        // If this hasn't been initialized then please initialize
+        if (!_initialized)
+        {
+          init(externalContext);
+        }
+
+        _attachRequestContext(externalContext);
+
+        if (externalContext.getRequestMap().get(_IN_REQUEST) == null)
+        {
+          _startConfiguratorServiceRequest(externalContext);
+        }
+      }
+      else
+      {
+        _LOG.fine("GlobalConfigurator: Configurators have been disabled for this request.");
+      }
+    }
+    else if (!RequestType.isCorrectType(externalContext))
+    {
+      // This will happen if the actionRequest was not ended before dispatching to the render
+      // request
+      throw new IllegalStateException("The previous action request was not ended.");
+    }
+    else
+    {
+      _LOG.fine("BeginRequest called multiple times for this request");
+    }
+  }
+
+  /**
+   * Cleans up the current configurator. This will execute the destroy method on all of the
+   * configurator services. Generally this will be called by Trinidad's context listener when the
+   * context is destroyed, but it may be used manually to allow the configurator to be
+   * re-initialized.
+   *
+   * Calling this method while the configurator is not initialized will not re-execute the destroy
+   * methods on the services.
+   *
+   * @see org.apache.myfaces.trinidad.config.Configurator#destroy()
+   */
+  @Override
+  public void destroy()
+  {
+    if (_initialized)
+    {
+      for (final Configurator config : _services)
+      {
+        try
+        {
+          config.destroy();
+        }
+        catch (final Throwable t)
+        {
+          // we always want to continue to destroy things, so log errors and continue
+          _LOG.severe(t);
+        }
+      }
+      _services = null;
+      _initialized = false;
+    }
+  }
+
+  /**
+   * Ends the currently begun request. It is important to note that this should be executed only
+   * once per physical request.
+   *
+   * @see org.apache.myfaces.trinidad.config.Configurator#endRequest(javax.faces.context.ExternalContext)
+   */
+  @Override
+  public void endRequest(final ExternalContext externalContext)
+  {
+    // do per virtual-request stuff
+    if (RequestType.getType(externalContext) != null)
+    {
+      if (!_isDisabled(externalContext))
+      {
+        final RequestType type = RequestType.getType(externalContext);
+
+        // Do not end services at the end of a portal action request
+        if (type != RequestType.PORTAL_ACTION)
+        {
+          _endConfiguratorServiceRequest(externalContext);
+        }
+        
+        _releaseRequestContext(externalContext);
+      }
+      RequestType.clearType(externalContext);
+    }
+  }
+
+  /**
+   * Returns an externalContext for this configurator and all of the configurator services. If this
+   * method is executed before {@link #beginRequest(ExternalContext)} then this method will call
+   * beginRequest(). It is important to note, however, that even though beginRequest does not need
+   * to be explicitly called, {{@link #endRequest(ExternalContext)} does need to be called when the
+   * request has completed or the contract to the configurators will be broken.
+   *
+   * @param externalContext
+   *          the ExternalContext object that should be wrapped.
+   *
+   * @return a decorated ExternalContext object
+   */
+  @Override
+  public ExternalContext getExternalContext(ExternalContext externalContext)
+  {
+    if (RequestType.getType(externalContext) == null)
+    {
+      beginRequest(externalContext);
+    }
+
+    if (!_isDisabled(externalContext))
+    {
+      if(!ExternalContextUtils.isPortlet(externalContext) && _isSetRequestBugPresent(externalContext))
+      {
+        //This handles bug 493 against the JSF-RI 1.2_03 and earlier.  If the bug
+        //is present in the current system, add a wrapper to fix it
+        
+        //TODO sobryan this is somewhat inefficient so should be removed when we
+        //are no longer dependant on JSF1.2_03 or earlier.  Still, we only wrap
+        //when we have to so it should be no biggy under normal circumstances.
+        externalContext = new ClearRequestExternalContext(externalContext);
+      }
+
+      // Wrap ExternalContexts
+      for (final Configurator config : _services)
+      {
+        externalContext = config.getExternalContext(externalContext);
+      }
+    }
+
+    return externalContext;
+  }
+
+  /**
+   * Initializes the global configurator and the configurator services. This method need not be
+   * called directly as it will be called from {@link #beginRequest(ExternalContext)} if needed. It
+   * is also possible to execute this method more then once, although if initialization has already
+   * happened then a call to this method will not do anything. To re-initialize this class, call
+   * {@link #destroy()} first and then call this method.
+   *
+   * @param externalContext
+   *          the externalContext needed to initialize this class
+   *
+   * @see org.apache.myfaces.trinidad.config.Configurator#init(javax.faces.context.ExternalContext)
+   */
+  @Override
+  public void init(final ExternalContext externalContext)
+  {
+    assert externalContext != null;
+
+    if (!_initialized)
+    {
+      _services = ClassLoaderUtils.getServices(Configurator.class.getName());
+
+      // Create a new RequestContextFactory is needed
+      if (RequestContextFactory.getFactory() == null)
+      {
+        RequestContextFactory.setFactory(new RequestContextFactoryImpl());
+      }
+
+      // Create a new SkinFactory if needed.
+      if (SkinFactory.getFactory() == null)
+      {
+        SkinFactory.setFactory(new SkinFactoryImpl());
+      }
+
+      // register the base skins
+      SkinUtils.registerBaseSkins();
+
+      for (final Configurator config : _services)
+      {
+        config.init(externalContext);
+      }
+
+      // after the 'services' filters are initialized, then register
+      // the skin extensions found in trinidad-skins.xml. This
+      // gives a chance to the 'services' filters to create more base
+      // skins that the skins in trinidad-skins.xml can extend.
+      SkinUtils.registerSkinExtensions(externalContext);
+
+      _initialized = true;
+    }
+    else
+    {
+      _LOG.warning("CONFIGURATOR_SERVICES_INITIALIZED");
+    }
+  }
+
+  /**
+   * @param externalContext
+   * @return
+   */
+  @SuppressWarnings("unchecked")
+  private void _attachRequestContext(final ExternalContext externalContext)
+  {
+    // If someone didn't release the RequestContext on an earlier request,
+    // then it'd still be around, and trying to create a new one
+    // would trigger an exception. We don't want to take down
+    // this thread for all eternity, so clean up after poorly-behaved code.
+    RequestContext context = RequestContext.getCurrentInstance();
+    if (context != null)
+    {
+      if (_LOG.isWarning())
+      {
+        _LOG.warning("REQUESTCONTEXT_NOT_PROPERLY_RELEASED");
+      }
+      context.release();
+    }
+
+    // See if we've got a cached RequestContext instance; if so,
+    // reattach it
+    final Object cachedRequestContext = externalContext.getRequestMap().get(
+        _REQUEST_CONTEXT);
+
+    // Catch both the null scenario and the
+    // RequestContext-from-a-different-classloader scenario
+    if (cachedRequestContext instanceof RequestContext)
+    {
+      context = (RequestContext) cachedRequestContext;
+      context.attach();
+    }
+    else
+    {
+      final RequestContextFactory factory = RequestContextFactory.getFactory();
+      assert factory != null;
+      context = factory.createContext(externalContext);
+      externalContext.getRequestMap().put(_REQUEST_CONTEXT, context);
+    }
+
+    assert RequestContext.getCurrentInstance() == context;
+  }
+  
+  private void _releaseRequestContext(final ExternalContext ec)
+  {
+    //If it's not a portal action, we should remove the cached request because
+    //well want to create a new one next request
+    if(RequestType.getType(ec) != RequestType.PORTAL_ACTION)
+    {
+      ec.getRequestMap().remove(_REQUEST_CONTEXT);
+    }
+    
+    final RequestContext context = RequestContext.getCurrentInstance();
+    if (context != null)
+    {
+      context.release();
+      assert RequestContext.getCurrentInstance() == null;
+    }    
+  }
+
+  private void _endConfiguratorServiceRequest(final ExternalContext ec)
+  {
+    // Physical request has now ended
+    // Clear the in-request flag
+    ec.getRequestMap().remove(_IN_REQUEST);
+    for (final Configurator config : _services)
+    {
+      config.endRequest(ec);
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  private void _startConfiguratorServiceRequest(final ExternalContext ec)
+  {
+    // Physical request has now begun
+    final boolean disabled = isConfiguratorServiceDisabled(ec);
+
+    // Tell whether the services were disabled when the requests had begun
+    ec.getRequestMap().put(_IN_REQUEST, disabled);
+
+    // If this hasn't been initialized then please initialize
+    for (final Configurator config : _services)
+    {
+      config.beginRequest(ec);
+    }
+  }
+  
+  static private boolean _isSetRequestBugPresent(ExternalContext ec)
+  {
+    // This first check is here in order to skip synchronization until 
+    // absolutely necessary.
+    if(!_sSetRequestBugTested)
+    {
+      synchronized(GlobalConfiguratorImpl.class)
+      {
+        //This second check is here in case a couple of things enter before the
+        //boolean is set.  This is only an exception case and will make it so
+        //the initialization code runs only once.
+        if(!_sSetRequestBugTested)
+        {
+          ServletRequest orig = (ServletRequest)ec.getRequest();
+          // Call getInitParameterMap() up front
+          ec.getInitParameterMap();
+          
+          ec.setRequest(new TestRequest(orig));
+          
+          _sHasSetRequestBug = !TestRequest.isTestParamPresent(ec);
+          _sSetRequestBugTested = true;
+          
+          ec.setRequest(orig);
+        }
+      }
+    }
+    
+    return _sHasSetRequestBug;
+  }
+  
+  // This handles an issue with the ExternalContext object prior to
+  // JSF1.2_04.
+  static private class ClearRequestExternalContext extends ExternalContextDecorator
+  {
+    private ExternalContext _ec;
+    private Map<String, Object>         _requestCookieMap;
+    private Map<String, String>         _requestHeaderMap;
+    private Map<String, String[]>       _requestHeaderValuesMap;
+    private Map<String, Object>         _requestMap;
+    private Map<String, String>         _requestParameterMap;
+    private Map<String, String[]>       _requestParameterValuesMap;
+    
+    public ClearRequestExternalContext(ExternalContext ec)
+    {
+      _ec = ec;
+    }
+    
+    @Override
+    protected ExternalContext getExternalContext()
+    {
+      return _ec;
+    }
+
+    @Override
+    public void setRequest(Object request)
+    {
+      super.setRequest(request);
+      
+      // And clear out any of the cached maps, since we should 
+      // go back and look in the map
+      _requestCookieMap = null;
+      _requestHeaderMap = null;
+      _requestHeaderValuesMap = null;
+      _requestMap = null;
+      _requestParameterMap = null;
+      _requestParameterValuesMap = null;
+    }
+    
+    @Override
+    public Map<String, Object> getRequestCookieMap()
+    {
+      _checkRequest();
+      if (_requestCookieMap == null)
+      {
+        
+        _requestCookieMap = new ServletCookieMap(_getHttpServletRequest());
+      }
+      return _requestCookieMap;
+    }
+
+    @Override
+    public Map<String, String> getRequestHeaderMap()
+    {
+      if (_requestHeaderMap == null)
+      {
+        _requestHeaderMap = new ServletRequestHeaderMap(_getHttpServletRequest());
+      }
+      return _requestHeaderMap;
+    }
+
+    @Override
+    public Map<String, String[]> getRequestHeaderValuesMap()
+    {
+      if (_requestHeaderValuesMap == null)
+      {
+        _requestHeaderValuesMap = new ServletRequestHeaderValuesMap(_getHttpServletRequest());
+      }
+      return _requestHeaderValuesMap;
+    }
+
+    @Override
+    public Map<String, Object> getRequestMap()
+    {
+      _checkRequest();
+      if (_requestMap == null)
+      {
+        _requestMap = new ServletRequestMap((ServletRequest)getRequest());
+      }
+      return _requestMap;
+    }
+
+    @Override
+    public Map<String, String> getRequestParameterMap()
+    {
+      _checkRequest();
+      if (_requestParameterMap == null)
+      {
+        _requestParameterMap = new ServletRequestParameterMap((ServletRequest)getRequest());
+      }
+      return _requestParameterMap;
+    }
+
+    @Override
+    public Map<String, String[]> getRequestParameterValuesMap()
+    {
+      _checkRequest();
+      if (_requestParameterValuesMap == null)
+      {
+        _requestParameterValuesMap = new ServletRequestParameterValuesMap((ServletRequest)getRequest());
+      }
+      return _requestParameterValuesMap;
+    }
+    
+    private void _checkRequest()
+    {
+      if(super.getRequest() == null)
+      {
+        throw new UnsupportedOperationException("Request is null on this context.");
+      }
+    }
+    
+    private HttpServletRequest _getHttpServletRequest()
+    {
+      _checkRequest();
+      if ( !(getRequest() instanceof HttpServletRequest))
+      {
+         throw new IllegalArgumentException("Only HttpServletRequest supported");
+      }
+      
+      return (HttpServletRequest)getRequest();
+    }
+  }
+  
+
+  private static volatile boolean _sSetRequestBugTested = false;
+  private static boolean _sHasSetRequestBug = false;
+
+  private boolean             _initialized;
+  private List<Configurator>  _services;
+  static private final Map<ClassLoader, GlobalConfiguratorImpl> _CONFIGURATORS =
+     new HashMap<ClassLoader, GlobalConfiguratorImpl>();
+  static private final String _IN_REQUEST    =
+     GlobalConfiguratorImpl.class.getName() 
+     + ".IN_REQUEST";
+  static private final String _REQUEST_CONTEXT =
+     GlobalConfiguratorImpl.class.getName()
+     + ".REQUEST_CONTEXT";
+
+    
+  private enum RequestType
+  {
+    PORTAL_ACTION,
+    PORTAL_RENDER,
+    SERVLET;
+
+    public static void clearType(final ExternalContext ec)
+    {
+      ec.getRequestMap().remove(_REQUEST_TYPE);
+    }
+
+    public static RequestType getType(final ExternalContext ec)
+    {
+      return (RequestType) ec.getRequestMap().get(_REQUEST_TYPE);
+    }
+
+    public static boolean isCorrectType(final ExternalContext ec)
+    {
+      return _findType(ec) == getType(ec);
+    }
+
+    @SuppressWarnings("unchecked")
+    public static void setType(final ExternalContext ec)
+    {
+      ec.getRequestMap().put(_REQUEST_TYPE, _findType(ec));
+    }
+
+    private static final RequestType _findType(final ExternalContext ec)
+    {
+      if (ExternalContextUtils.isPortlet(ec))
+      {
+        if (ExternalContextUtils.isAction(ec))
+        {
+          return PORTAL_ACTION;
+        }
+        else
+        {
+          return PORTAL_RENDER;
+        }
+      }
+      else
+      {
+        return SERVLET;
+      }
+    }
+
+    static private final String _REQUEST_TYPE = GlobalConfiguratorImpl.class.getName()
+                                                  + ".REQUEST_TYPE";
+  }
+  
+  static private class TestRequest extends ServletRequestWrapper
+  {
+    public TestRequest(ServletRequest request)
+    {
+      super(request);
+    }
+
+    @Override
+    public String getParameter(String string)
+    {
+      if(_TEST_PARAM.equals(string))
+      {
+        return "passed";
+      }
+      
+      return super.getParameter(string);
+    }
+    
+    static public final boolean isTestParamPresent(ExternalContext ec)
+    {
+      return ec.getRequestParameterMap().get(_TEST_PARAM) != null;
+    }
+    
+    static private String _TEST_PARAM = TestRequest.class.getName()+
+      ".TEST_PARAM";
+  }
+
+
+  static private final TrinidadLogger _LOG =
+    TrinidadLogger.createTrinidadLogger(GlobalConfiguratorImpl.class);
+}

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/dispatch/DispatchResponseConfiguratorImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/dispatch/DispatchResponseConfiguratorImpl.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/dispatch/DispatchResponseConfiguratorImpl.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/dispatch/DispatchResponseConfiguratorImpl.java Sun Oct  7 10:34:29 2007
@@ -29,7 +29,6 @@
 import javax.portlet.PortletRequestDispatcher;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
-import javax.servlet.ServletResponse;
 
 import org.apache.myfaces.trinidad.config.Configurator;
 import org.apache.myfaces.trinidad.context.ExternalContextDecorator;
@@ -48,28 +47,24 @@
   @Override
   public ExternalContext getExternalContext(ExternalContext externalContext)
   {
-    // TODO sobryan (dependency = JSF 1.2)
-    // For JSF 1.2, we can probably simply wrap the request objects and set them on
-    // the existing ExternalContext.
     if(!isApplied(externalContext))
     {
       if(ExternalContextUtils.isPortlet(externalContext))
       {
         if(!ExternalContextUtils.isAction(externalContext))
         {
-          apply(externalContext);
-          return new PortletExternalContext(externalContext);
+          externalContext.setResponse(new DispatchRenderResponse(externalContext));
         }
       }
       else
       {
-        apply(externalContext);
-        return new ServletExternalContext(externalContext);
+        externalContext.setResponse(new DispatchServletResponse(externalContext));
       }
-    }
 
+      apply(externalContext);
+    }
 
-    //return the origional
+    //return the original
     return externalContext;
   }
 
@@ -79,104 +74,6 @@
   {
     Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
     return (String) requestMap.get(__CONTENT_TYPE_KEY);
-  }
-
-  static private class ServletExternalContext extends ExternalContextDecorator
-  {
-    public ServletExternalContext(ExternalContext ec)
-    {
-      _ec = ec;
-    }
-
-    @Override
-    public Object getResponse()
-    {
-      if(_response == null)
-      {
-        _response = new DispatchServletResponse(_ec);
-      }
-
-      return _response;
-    }
-
-    @Override
-    protected ExternalContext getExternalContext()
-    {
-      return _ec;
-    }
-
-    private ServletResponse  _response;
-    private ExternalContext _ec;
-  }
-
-  static private class PortletExternalContext extends ExternalContextDecorator
-  {
-    public PortletExternalContext(ExternalContext ec)
-    {
-      _ec = ec;
-    }
-
-    @Override
-    public Object getContext()
-    {
-      return _getPortletContext();
-    }
-
-    @Override
-    public Object getResponse()
-    {
-      return _getRenderResponse();
-    }
-
-    @Override
-    public void dispatch(String path) throws IOException
-    {
-      final PortletRequestDispatcher requestDispatcher =
-        ((PortletContext)getContext()).getRequestDispatcher(path);
-      try
-      {
-        requestDispatcher.include((RenderRequest)getRequest(), (RenderResponse)getResponse());
-      }
-      catch (final PortletException e)
-      {
-        if (e.getMessage() != null)
-        {
-          throw new FacesException(e.getMessage(), e);
-        }
-        else
-        {
-          throw new FacesException(e);
-        }
-      }
-    }
-
-    @Override
-    protected ExternalContext getExternalContext()
-    {
-      return _ec;
-    }
-
-    private PortletContext _getPortletContext()
-    {
-      if(_context == null)
-      {
-        _context = new PortletContextWrapper((PortletContext)_ec.getContext());
-      }
-      return _context;
-    }
-
-    private RenderResponse _getRenderResponse()
-    {
-      if(_response == null)
-      {
-        _response = new DispatchRenderResponse(_ec);
-      }
-      return _response;
-    }
-
-    private ExternalContext _ec;
-    private RenderResponse _response;
-    private PortletContext _context;
   }
 
   /**

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java Sun Oct  7 10:34:29 2007
@@ -25,6 +25,10 @@
 import java.util.Map;
 
 import javax.faces.context.ExternalContext;
+
+import javax.portlet.ActionRequest;
+
+import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.myfaces.trinidad.config.Configurator;
@@ -209,8 +213,10 @@
     if(!isApplied(externalContext))
     {
       if(!ExternalContextUtils.isPortlet(externalContext))
-      {
-        return new ServletUploadedExternalContext(externalContext, addedParams);
+      {  
+        externalContext.setRequest(new UploadRequestWrapper(
+            (HttpServletRequest)externalContext.getRequest(),
+            addedParams));        
       }
       else if(ExternalContextUtils.isAction(externalContext))
       {
@@ -220,8 +226,10 @@
          * RenderParameters.  This is a cool thing because subsequent
          * render requests will retain these parameters for us.
          */
-        return new PortletUploadedExternalContext(externalContext, addedParams);
+        externalContext.setRequest(new ActionUploadRequestWrapper(externalContext,
+           addedParams));
       }
+      apply(externalContext);        
     }
 
     //If we don't have any wrapped params or we have a render portal request,

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/xmlHttp/XmlHttpConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/xmlHttp/XmlHttpConfigurator.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/xmlHttp/XmlHttpConfigurator.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/xmlHttp/XmlHttpConfigurator.java Sun Oct  7 10:34:29 2007
@@ -50,11 +50,6 @@
   {
   }
 
-  public static ServletResponse getWrappedServletResponse(ServletResponse response)
-  {
-    return new XmlHttpServletResponse(response);
-  }
-
   public static ServletRequest getAjaxServletRequest(ServletRequest request)
   {
     return new XmlHttpServletRequest(request);
@@ -63,6 +58,12 @@
   public static void beginRequest(ExternalContext externalContext)
   {
     StateManagerImpl.reuseRequestTokenForResponse(externalContext);
+    Object response = externalContext.getResponse();
+    if (response instanceof ServletResponse)
+    {
+      externalContext.setResponse(
+         new XmlHttpServletResponse((ServletResponse) response));
+    }
   }
 
   /**

Modified: myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/DialogServiceImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/DialogServiceImpl.java?rev=582656&r1=582655&r2=582656&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/DialogServiceImpl.java (original)
+++ myfaces/trinidad/branches/1.2.3-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/DialogServiceImpl.java Sun Oct  7 10:34:29 2007
@@ -24,10 +24,11 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.el.ValueExpression;
+
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
 import javax.faces.render.RenderKit;
 
 import org.apache.myfaces.trinidad.context.RequestContext;
@@ -213,8 +214,9 @@
     FacesContext context = _getFacesContext();
     if (TrinidadFilterImpl.isExecutingDialogReturn(context))
     {
-      Map<String, Object> parameterMap = context.getExternalContext().getRequestParameterMap();
-      Object returnParam = parameterMap.get(_RETURN_PARAM);
+      Map<String, String> parameterMap =
+        context.getExternalContext().getRequestParameterMap();
+      String returnParam = parameterMap.get(_RETURN_PARAM);
       if (returnParam == null)
         return null;
 
@@ -464,9 +466,9 @@
   @SuppressWarnings("unchecked")
   private void _executeBindings(FacesContext context, UIComponent component)
   {
-    ValueBinding binding = component.getValueBinding("binding");
-    if (binding != null)
-      binding.setValue(context, component);
+    ValueExpression expression = component.getValueExpression("binding");
+    if (expression != null)
+      expression.setValue(context.getELContext(), component);
 
     Iterator<UIComponent> kids = component.getFacetsAndChildren();
     while (kids.hasNext())