You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:29:56 UTC

[myfaces-trinidad] branch jsf2_ajax.2 created (now 820c5e9)

This is an automated email from the ASF dual-hosted git repository.

deki pushed a change to branch jsf2_ajax.2
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git.


      at 820c5e9  Merged in the old jsf2_ajax branch

This branch includes the following new commits:

     new f9f18a6  Rebranching AJAX branch
     new 820c5e9  Merged in the old jsf2_ajax branch

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].

[myfaces-trinidad] 01/02: Rebranching AJAX branch

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch jsf2_ajax.2
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit f9f18a6d315812d161e5f5aaeb805304a1e74d31
Author: Max Starets <ms...@apache.org>
AuthorDate: Thu Mar 18 14:35:33 2010 +0000

    Rebranching AJAX branch

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 02/02: Merged in the old jsf2_ajax branch

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch jsf2_ajax.2
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 820c5e945d2014a01c16b53756d3fd40642138d7
Author: Max Starets <ms...@apache.org>
AuthorDate: Fri Mar 19 15:33:01 2010 +0000

    Merged in the old jsf2_ajax branch
---
 .../src/main/webapp/WEB-INF/trinidad-config.xml    |   2 +-
 .../trinidad-demo/src/main/webapp/WEB-INF/web.xml  |  16 +-
 .../src/main/webapp/demos/ajaxPPRDemos.xhtml       | 241 +++++++++++
 .../src/main/conf/META-INF/faces-config-base.xml   |   3 +
 .../context/PartialViewContextFactoryImpl.java     |  46 +++
 .../context/PartialViewContextImpl.java            | 455 +++++++++++++++++++++
 .../renderkit/core/CoreRenderKit.java              |  22 +-
 .../renderkit/core/ppr/PPRResponseWriter.java      | 121 ++++--
 .../renderkit/core/xhtml/CommandLinkRenderer.java  |   2 +-
 .../renderkit/core/xhtml/DocumentRenderer.java     |   2 +
 .../renderkit/core/xhtml/HeadRenderer.java         |   2 +
 .../main/javascript/META-INF/adf/jsLibs/Core.js    |  13 +-
 .../main/javascript/META-INF/adf/jsLibs/Page.js    | 168 +++++++-
 .../META-INF/adf/jsLibs/xhr/RequestQueue.js        | 102 +++--
 .../META-INF/adf/jsLibs/xhr/XMLRequest.js          | 136 +++++-
 .../META-INF/adf/jsLibs/xhr/XMLRequestEvent.js     |  20 +-
 16 files changed, 1252 insertions(+), 99 deletions(-)

diff --git a/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/trinidad-config.xml b/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/trinidad-config.xml
index af3f1a5..217b932 100644
--- a/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/trinidad-config.xml
+++ b/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/trinidad-config.xml
@@ -19,7 +19,7 @@
 	   
 -->
 <trinidad-config xmlns="http://myfaces.apache.org/trinidad/config">
-  <debug-output>true</debug-output>
+  <!--debug-output>true</debug-output-->
   <!-- Uncomment to switch back to ALERT style client-side validation,
     or set to DISABLED to disable it altogether
   <client-validation>ALERT</client-validation>
diff --git a/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml b/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml
index 02069e0..a6797c0 100644
--- a/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml
+++ b/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/web.xml
@@ -29,13 +29,6 @@
     <param-value>Development</param-value>
   </context-param>
 
-  <!-- *IF* we execute this demo in JSF2 / JavaEE 6 env, we want to use
-       the "OLD" Facelet version -->
-  <context-param>
-    <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
-    <param-value>true</param-value>
-  </context-param>
-
   <context-param>
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
     <param-value>.jspx</param-value>
@@ -74,10 +67,10 @@
 
   <!-- Trinidad by default uses an optimized client-side state saving
        mechanism. To disable that, uncomment the following -->
-  <!--context-param>
+  <context-param>
     <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_METHOD</param-name>
-    <param-value>all</param-value>
-  </context-param-->
+    <param-value>token</param-value>
+  </context-param>
 <!-- When token client-side state saving is enabled, MyFaces Trinidad can apply an additional
      optimization by caching an entire UIViewRoot tree with each token. 
      (Note that this does not affect thread safety or session failover.) 
@@ -107,9 +100,8 @@
 
   <context-param>
     <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
-    <param-value>*.xhtml</param-value>
     <!-- to run facelets for jspx files comment the line above and uncomment line below-->
-    <!--param-value>*.xhtml;*.jspx</param-value-->
+    <param-value>*.xhtml;*.jspx</param-value>
   </context-param>
 
   <context-param>
diff --git a/trinidad-examples/trinidad-demo/src/main/webapp/demos/ajaxPPRDemos.xhtml b/trinidad-examples/trinidad-demo/src/main/webapp/demos/ajaxPPRDemos.xhtml
new file mode 100644
index 0000000..fe9e8d4
--- /dev/null
+++ b/trinidad-examples/trinidad-demo/src/main/webapp/demos/ajaxPPRDemos.xhtml
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
+<!--
+    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.
+
+-->
+
+<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:f="http://java.sun.com/jsf/core" xmlns:tr="http://myfaces.apache.org/trinidad"
+                xmlns:trd="http://myfaces.apache.org/trinidad/demo"
+                xmlns:trh="http://myfaces.apache.org/trinidad/html">
+  <tr:document title="Partial Page Rendering Demos"
+    onload="init();">
+    <f:facet name="metaContainer">
+      <tr:group>
+        <trh:script>
+function pprStateChangeFunction(state)
+{
+  var inputText = document.getElementById("it1");
+  if (inputText.value.length)
+  {
+    inputText.value += "\n";
+  }
+  var stateStr = (state == TrRequestQueue.STATE_READY) ? "ready" : "busy";
+  inputText.value += "State has changed to "+stateStr;
+  inputText.scrollTop = inputText.scrollHeight;
+}
+function pprDomReplacementFunction(oldDom, newDom)
+{
+  var inputText = document.getElementById("it1");
+  if (inputText.value.length)
+  {
+    inputText.value += "\n";
+  }
+  if (newDom === document.body)
+  {
+    inputText.value += "Document body was replaced";
+  }
+  else
+  {
+    inputText.value += "DOM element with ID " +
+      newDom.getAttribute("id") + " was replaced";
+  }
+  inputText.scrollTop = inputText.scrollHeight;
+}
+function init()
+{
+  TrPage.getInstance().getRequestQueue().addStateChangeListener(pprStateChangeFunction);
+  TrPage.getInstance().addDomReplaceListener(pprDomReplacementFunction);
+}
+function setFocus(event)
+{
+  event.target.focus();
+}
+        </trh:script>
+      </tr:group>
+    </f:facet>
+    <tr:form>
+      <tr:panelPage>
+        <f:facet name="navigationGlobal">
+          <tr:panelGroupLayout id="pgl1" layout="horizontal">
+            <f:facet name="separator">
+              <tr:spacer width="10" />
+            </f:facet>
+            <tr:navigationPane hint="buttons">
+              <tr:commandNavigationItem text="Return to Feature Demos page" immediate="true"
+                                        action="demos"/>
+            </tr:navigationPane>
+            <tr:statusIndicator id="si1" />
+          </tr:panelGroupLayout>
+        </f:facet>
+        <tr:panelHeader text="Welcome to the Apache Trinidad Partial Page Rendering Demos for JSF 2.0 Ajax">
+          <tr:outputFormatted styleUsage="instruction" id="of0"
+                              value="These demos test Trinidad PPR with JSF 2.0 Ajax using both trinidad and JSF components."/>
+          <tr:panelGroupLayout layout="vertical">
+            <f:facet name="separator">
+              <tr:spacer width="30" height="10"/>
+            </f:facet>
+            <tr:panelHeader text="Command components using JSF 2.0 native Ajax support" id="phCmd">
+              <tr:outputFormatted styleUsage="instruction" id="of10"
+                                  value="Tests commandButton components wired to use either Ajax JS API by itself or both JSF 2 Ajax and trinidad PPR. Clicking these buttons should cause a partial or a full page submit (without errors) and update the field on the right."/>
+              <tr:spacer height="10" id="sp10"/>
+              <tr:panelGroupLayout layout="horizontal" id="pgl10">
+                <tr:panelGroupLayout layout="vertical" id="pgl11">
+                  <f:facet name="separator">
+                    <tr:spacer height="6" id="sp11"/>
+                  </f:facet>
+                  <tr:outputFormatted styleUsage="instruction"
+                                      value="tr:commandButton using jsf.ajax.request and partialSubmit=true."
+                                      id="of11"/>
+                  <tr:commandButton id="axBtn1" partialSubmit="true" text="Partial Submit"
+                                    shortDesc="partialSubmit"
+                                    actionListener="#{partialDemoUtil.action}"/>
+                  <!--f:ajax event="action" render=""/-->
+                  <tr:outputFormatted styleUsage="instruction"
+                                      value="tr:commandButton using jsf.ajax.request." id="of12"/>
+                  <tr:commandButton id="axBtn2" text="Full Submit" shortDesc="fullSubmit"
+                                    actionListener="#{partialDemoUtil.action}"/>
+                  <tr:outputFormatted styleUsage="instruction"
+                                      value="h:commandButton using jsf.ajax.request." id="of13"/>
+                </tr:panelGroupLayout>
+                <tr:spacer width="30" height="10" id="sp12"/>
+                <tr:panelGroupLayout id="pgl12" layout="vertical">
+                  <f:facet name="separator">
+                    <tr:spacer height="6" id="sp13"/>
+                  </f:facet>
+                  <tr:statusIndicator id="si2" />
+                  <tr:panelLabelAndMessage label="Button Clicked: " id="plm10">
+                    <tr:outputFormatted id="btnTarget" partialTriggers="axBtn1 axBtn2"
+                                        styleUsage="instruction"
+                                        value="#{partialDemoUtil.status.linkUpdate}">
+                      <f:convertDateTime pattern="HH:mm:ss"/>
+                    </tr:outputFormatted>
+                  </tr:panelLabelAndMessage>
+                </tr:panelGroupLayout>
+              </tr:panelGroupLayout>
+            </tr:panelHeader>
+            <tr:panelHeader text="InputText Component using JSF 2.0 Ajax" id="phInput">
+              <tr:outputFormatted styleUsage="instruction"
+                                  value="Tests autoSubmitting text fields which is also wired to use JSF 2.0 Ajax."/>
+              <tr:panelGroupLayout layout="horizontal" id="pgl20">
+                <f:facet name="separator">
+                  <tr:spacer height="10" id="sp20"/>
+                </f:facet>
+                <tr:panelGroupLayout layout="vertical" id="pgl21">
+                  <f:facet name="separator">
+                    <tr:spacer height="6" id="sp21"/>
+                  </f:facet>
+                  <tr:outputFormatted styleUsage="instruction"
+                                      value="tr:inputText with autoSubmit=true."
+                                      id="of20"/>
+                  <tr:inputText id="itxt1" autoSubmit="true"
+                                value="#{partialDemoUtil.status.textValue}"
+                                label="Enter text and tab out: "
+                                valueChangeListener="#{partialDemoUtil.valueChanged}"/>
+                  <tr:outputFormatted styleUsage="instruction"
+                                      value="tr:inputText with autoSubmit=true inside a subform"
+                                      id="of21"/>
+                  <tr:subform id="sf20">
+                    <tr:inputText autoSubmit="true" id="itxt2"
+                                  label="Enter a different text and tab out: "
+                                  value="#{partialDemoUtil.status.textValue}"
+                                  valueChangeListener="#{partialDemoUtil.valueChanged}"/>
+                  </tr:subform>
+                </tr:panelGroupLayout>
+                <tr:panelGroupLayout id="pgl21" layout="vertical">
+                  <f:facet name="separator">
+                    <tr:spacer height="6" id="sp22"/>
+                  </f:facet>
+                  <tr:statusIndicator id="si3" />
+                  <tr:panelLabelAndMessage label="Input entered: ">
+                    <tr:outputFormatted id="itTarget" partialTriggers="itxt1 ::sf20:itxt2"
+                                        styleUsage="instruction"
+                                        value="#{partialDemoUtil.status.textStateText}"/>
+                  </tr:panelLabelAndMessage>
+                </tr:panelGroupLayout>
+              </tr:panelGroupLayout>
+            </tr:panelHeader>
+            <tr:panelHeader text="Radio Buttons">
+              <tr:outputFormatted styleUsage="instruction"
+                                  value="This demo shows a two sets of radio buttons which use autoSubmit. There is also an output component which is listening on updates to the radio buttons and displaying status text accordingly."/>
+              <tr:panelGroupLayout layout="horizontal">
+                <tr:panelGroupLayout layout="vertical">
+                  <tr:panelGroupLayout layout="horizontal">
+                    <tr:outputFormatted styleUsage="instruction"
+                                        value="selectBooleanRadio buttons"/>
+                    <tr:panelGroupLayout layout="vertical">
+                      <tr:selectBooleanRadio id="sbr1" group="theGroup" selected="false"
+                                             text="item 1" autoSubmit="true"
+                                             valueChangeListener="#{partialDemoUtil.valueChanged}"/>
+                      <tr:selectBooleanRadio id="sbr2" group="theGroup" text="item 2"
+                                             selected="false" autoSubmit="true"
+                                             valueChangeListener="#{partialDemoUtil.valueChanged}"/>
+                      <tr:selectBooleanRadio id="sbr3" group="theGroup" text="item 3"
+                                             selected="false" autoSubmit="true"
+                                             valueChangeListener="#{partialDemoUtil.valueChanged}"/>
+                    </tr:panelGroupLayout>
+                  </tr:panelGroupLayout>
+                  <tr:spacer width="30" height="10"/>
+                  <tr:panelGroupLayout layout="vertical">
+                    <tr:selectOneRadio id="sor1" label="selectOneRadio buttons" autoSubmit="true"
+                                       valueChangeListener="#{partialDemoUtil.valueChanged}">
+                      <tr:selectItem label="item 1" value="1"/>
+                      <tr:selectItem label="item 2" value="2"/>
+                      <tr:selectItem label="item 3" value="3"/>
+                    </tr:selectOneRadio>
+                  </tr:panelGroupLayout>
+                </tr:panelGroupLayout>
+                <tr:spacer width="30" height="10"/>
+                <tr:panelGroupLayout id="pgl31" layout="vertical">
+                  <f:facet name="separator">
+                    <tr:spacer height="6" id="sp31"/>
+                  </f:facet>
+                  <tr:statusIndicator id="si4" />
+                  <tr:panelLabelAndMessage label="Selected: ">
+                    <tr:outputFormatted id="rbTarget" partialTriggers="sbr1 sbr2 sbr3 sor1"
+                                        styleUsage="instruction"
+                                        value="#{partialDemoUtil.status.radioStateText}">
+                      <f:convertDateTime pattern="HH:mm:ss"/>
+                    </tr:outputFormatted>
+                  </tr:panelLabelAndMessage>
+                </tr:panelGroupLayout>
+              </tr:panelGroupLayout>
+            </tr:panelHeader>
+            <tr:panelHeader text="Focus Restoration">
+              <tr:outputFormatted styleUsage="instruction"
+                                  value="The below command button gets the focus on mouse down and its parent is updated by PPR. It should regain focus after the PPR completes." />
+              <tr:panelGroupLayout id="frpgl1" layout="horizontal" partialTriggers="frcb1">
+                <f:facet name="separator">
+                  <tr:spacer width="10" id="sp41"/>
+                </f:facet>
+                <tr:commandButton id="frcb1" text="Demonstrate focus restoration"
+                                  partialSubmit="true">
+                  <trd:invokeFunctionBehavior function="setFocus" event="mousedown" />
+                </tr:commandButton>
+                <tr:statusIndicator id="si5" />
+              </tr:panelGroupLayout>
+            </tr:panelHeader>
+          </tr:panelGroupLayout>
+          <tr:panelLabelAndMessage id="plam1" label="Ajax Status Log">
+            <tr:inputText id="it1" value="" simple="true" rows="7" columns="100" />
+          </tr:panelLabelAndMessage>
+        </tr:panelHeader>
+      </tr:panelPage>
+    </tr:form>
+  </tr:document>
+</ui:composition>
\ No newline at end of file
diff --git a/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml b/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml
index 92d4a99..d3941c1 100644
--- a/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml
+++ b/trinidad-impl/src/main/conf/META-INF/faces-config-base.xml
@@ -42,6 +42,9 @@
     <view-declaration-language-factory>
       org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl
     </view-declaration-language-factory>
+    <partial-view-context-factory>
+      org.apache.myfaces.trinidadinternal.context.PartialViewContextFactoryImpl
+    </partial-view-context-factory>
   </factory>
 
   <lifecycle>
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextFactoryImpl.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextFactoryImpl.java
new file mode 100644
index 0000000..0824cc0
--- /dev/null
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextFactoryImpl.java
@@ -0,0 +1,46 @@
+/*
+ *  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.context;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.FacesContextFactory;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.PartialViewContextFactory;
+
+public class PartialViewContextFactoryImpl
+  extends PartialViewContextFactory
+{
+  public PartialViewContextFactoryImpl(PartialViewContextFactory factory)
+  {
+    _factory = factory;
+  }
+
+  /**
+   * Creates a PartialViewContext instance that is optimized for Trinidad PPR.
+   * @param context 
+   * @return a PartialViewContext instance
+   */
+  public PartialViewContext getPartialViewContext(FacesContext context)
+  {
+    return new PartialViewContextImpl(context);
+  }
+  
+  private final PartialViewContextFactory _factory;
+  
+}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java
new file mode 100644
index 0000000..2200932
--- /dev/null
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java
@@ -0,0 +1,455 @@
+/*
+ *  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.context;
+
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import java.util.EnumSet;
+import java.util.Iterator;
+import java.util.List;
+
+import java.util.Set;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.event.PhaseId;
+
+import org.apache.myfaces.trinidad.component.UIXComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitHint;
+import javax.faces.component.visit.VisitResult;
+import org.apache.myfaces.trinidad.context.PartialPageContext;
+import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PPRResponseWriter;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
+
+public class PartialViewContextImpl extends PartialViewContext
+{
+  public PartialViewContextImpl(FacesContext context) 
+  {
+    _context = context;
+  }
+
+  /**
+   * To force a full execute we always return an empty execute list.
+   * @return
+   */
+  public Collection<String> getExecuteIds()
+  {
+    /*
+    if (_executeIds == null) 
+    {
+      String executeStr = _facesContext.getExternalContext().getRequestParameterMap().get(
+        PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME);
+    }
+    else
+    {
+      _executeIds = new ArrayList<String>();
+    }
+    */ 
+    _executeIds = new ArrayList<String>();
+    return _executeIds;
+  }
+
+  public Collection<String> getRenderIds()
+  {
+    return Collections.emptySet();
+  }
+
+  /**
+   * Return a PartialResponseWriter that consumes the Trinidad PprResponseWriter. 
+   * @return
+   */
+  public PartialResponseWriter getPartialResponseWriter()
+  {
+    if (_partialResponseWriter == null) 
+    {
+      _partialResponseWriter = new PPRPartialResponseWriter(_context.getResponseWriter());
+    }
+    return _partialResponseWriter;
+  }
+
+  public boolean isAjaxRequest()
+  {
+    _assertNotReleased();
+    if (_ajaxRequest == null) 
+    {
+        _ajaxRequest = _PARTIAL_AJAX.equals(_context.
+            getExternalContext().getRequestHeaderMap().get(_FACES_REQUEST));
+    }
+    return _ajaxRequest;
+  }
+
+  public boolean isPartialRequest()
+  {
+    _assertNotReleased();
+    if (_partialRequest == null) {
+        _partialRequest = isAjaxRequest() ||
+                _PARTIAL_PROCESS.equals(_context.
+                getExternalContext().getRequestHeaderMap().get(_FACES_REQUEST));
+    }
+    return _partialRequest;  
+  }
+
+  /**
+   * Trinidad PPR currently does a full decode/validate/update. So we return 'false' here, but in 
+   * processPartial, turn into a 'full tree visit'.
+   * @return true as the default executeList is set to be '@all'.
+   */
+  public boolean isExecuteAll()
+  {
+    _assertNotReleased();
+    String execute = _context.getExternalContext().getRequestParameterMap()
+      .get(PARTIAL_EXECUTE_PARAM_NAME);
+    
+    return execute.equals(this.ALL_PARTIAL_PHASE_CLIENT_IDS);
+  }
+
+  public boolean isRenderAll()
+  {
+    _assertNotReleased();
+    if (_renderAll == null) {
+        String render = _context.getExternalContext().getRequestParameterMap()
+                .get(PARTIAL_RENDER_PARAM_NAME);
+        _renderAll = (ALL_PARTIAL_PHASE_CLIENT_IDS.equals(render));
+    }
+
+    return _renderAll;  
+  }
+
+  public void setRenderAll(boolean renderAll)
+  {
+    _renderAll = renderAll;
+  }
+
+  public void setPartialRequest(boolean isPartialRequest)
+  {
+    _partialRequest = isPartialRequest;
+  }
+
+  public void release()
+  {
+    _ajaxRequest = null;
+    _executeIds = null;
+    _context = null;
+    _partialRequest = null;
+    _partialResponseWriter = null;
+    _released = true;
+    _renderAll = null;
+    _renderIds = null;
+  }
+
+  /**
+   * Handles the render phase alone as we perform a full 'execute' always.
+   * 
+   * @param phaseId
+   */
+  public void processPartial(PhaseId phaseId)
+  {
+    UIViewRoot viewRoot = _context.getViewRoot();
+    if (phaseId == PhaseId.APPLY_REQUEST_VALUES ||
+        phaseId == PhaseId.PROCESS_VALIDATIONS ||
+        phaseId == PhaseId.UPDATE_MODEL_VALUES)
+    {
+      // Assume the executeIds is set to @all to mimic a full tree visit. 
+      // Create a FullVisitContext
+      Collection <String> executeIds = getExecuteIds();
+
+      try 
+      {
+        _processExecute(viewRoot, phaseId, executeIds);
+      } 
+      catch (Exception e) 
+      {
+          // RELEASE_PENDING LOG EXCEPTION
+      }
+      
+    }
+    else if (phaseId == PhaseId.RENDER_RESPONSE)
+    {
+      _processRender(viewRoot, phaseId);
+    }
+
+  }
+
+  /**
+   * Performs a 'full' execute if executeIds is empty, in order to build the partialTrigger 
+   * listeners. Later, support for an 'optimized execute' will be added that 'visits' the executeId 
+   * components using the Trinidad visitTree implementation (that accounts for setup/teardown of 
+   * contexts.)
+   * @param component the UIViewRoot
+   * @param phaseId
+   * @param executeIds the Collection of ids to execute
+   */
+  private void _processExecute(
+    UIViewRoot component, 
+    PhaseId phaseId,
+    Collection<String> executeIds)
+  {
+    if (executeIds == null || executeIds.isEmpty())
+    {
+      // We use the tree visitor mechanism to locate the components to process. For now we ignore the 
+      // executeIds as we always want to perform a full decode. So a FullVisitContext is created and 
+      // the VisitCallback invoked for every component in the tree. 
+      VisitContext visitContext = 
+        RequestContext.getCurrentInstance().createVisitContext(_context, 
+                                                               executeIds, 
+                                                               _EXECUTE_VISIT_HINTS, 
+                                                               phaseId);
+      VisitCallback visitCallback = new ExecuteAllCallback(_context, phaseId);
+      UIXComponent.visitTree(visitContext, component, visitCallback);
+    }
+    else
+    {
+      // TODO: optimized decode??  
+    }
+  }
+
+  /**
+   * Performs a partial optimized rendering, if PPROptimization is enabled, otherwise defaults to a 
+   * full render. 
+   * 
+   * @param viewRoot
+   * @param phaseId
+   */
+  private void _processRender(UIComponent viewRoot, PhaseId phaseId)
+  {
+    boolean documentStarted = false;
+    
+    PartialResponseWriter partialResponseWriter = getPartialResponseWriter();
+    // Hold onto the original writer for later
+    ResponseWriter origResponseWriter = _context.getResponseWriter();
+    _context.setResponseWriter(partialResponseWriter);
+
+    ExternalContext extContext = _context.getExternalContext();
+    extContext.setResponseContentType(_RESPONSE_CONTENT_TYPE);
+    extContext.addResponseHeader("Pragma", "no-cache");
+    extContext.addResponseHeader("Cache-control", "no-cache");
+
+    try
+    {
+      partialResponseWriter.startDocument();
+      documentStarted = true;
+    
+      // determine whether we should try and optimize the PPR rendering
+      boolean encodeAllChildren = !PartialPageUtils.isOptimizedPPREnabled(_context, true);
+      
+      if (encodeAllChildren)
+      {
+        // We are guaranteed to be called on UIViewRoot. 
+        if (!viewRoot.isRendered()) 
+        {
+          return;
+        }
+      
+        // No PPR optimization, so encode all children
+        Iterator<UIComponent> children = viewRoot.getFacetsAndChildren();
+        while (children.hasNext()) 
+        {
+          children.next().encodeAll(_context);
+        }
+        
+        // TODO: Explcitly render out the view state as an update element.
+        _renderViewState(partialResponseWriter);
+      }
+      else
+      {
+        // TODO 
+        // HINT: PartialPageContext already creates a partial visit context. Reuse it??
+        
+        // Only visit tree if renderIds exist
+        Collection <String> renderIds = getRenderIds();
+        if (renderIds != null && !renderIds.isEmpty())
+        {
+          // perform an optimized partial visit of the children
+          RenderingContext rContext = RenderingContext.getCurrentInstance();
+          PartialPageContext pprContext = rContext.getPartialPageContext();
+         
+          VisitContext visitContext = pprContext.getVisitContext();
+          // component.visitTree(visitContext, new PhaseAwareVisitCallback(_context, phaseId));
+        }
+      }
+    }
+    catch (IOException e)
+    {
+      // launder the IOException as a FacesException, we'll unwrap this later
+      throw new FacesException(e);        
+    }
+    finally
+    {
+      try
+      {
+        if (documentStarted)
+        {
+          partialResponseWriter.endDocument();
+          documentStarted = false;
+        }
+      }
+      catch (IOException ioe2)
+      {
+        // TODO log exception
+      }
+      _context.setResponseWriter(origResponseWriter);
+    }
+  }
+  
+  private void _renderViewState(PartialResponseWriter writer)
+    throws IOException
+  {
+    // Get the view state and write it to the response..
+    writer.startUpdate(PartialResponseWriter.VIEW_STATE_MARKER);
+    String state = _context.getApplication().getStateManager().getViewState(_context);
+    writer.write(state);
+    writer.endUpdate();    
+  }
+  
+  @SuppressWarnings({"FinalPrivateMethod"})
+  private final void _assertNotReleased() 
+  {
+    if (_released) {
+        throw new IllegalStateException();
+    }
+  }
+
+
+
+
+  /**
+   * A simple PartialRepsonseWriter implementation that delegates most of its calls to the
+   * PPRResponseWriter as it already has the smarts to generate XML partial Ajax responses using the
+   * Trinidad partialTriggers mechanism.
+   */
+  private static final class PPRPartialResponseWriter extends PartialResponseWriter 
+  {
+    public PPRPartialResponseWriter(ResponseWriter writer)
+    {
+      super(null);
+      assert(writer instanceof PPRResponseWriter);
+      _pprWriter = (PPRResponseWriter) writer;
+    }
+
+    @Override
+    public void endDocument() throws IOException
+    {
+      getWrapped().endDocument();
+    }
+
+    @Override
+    public ResponseWriter getWrapped()
+    {
+      return _pprWriter;
+    }
+
+    @Override
+    public void startDocument() throws IOException
+    {
+      getWrapped().startDocument();
+    }
+
+
+    @Override
+    public void endUpdate()
+      throws IOException
+    {
+      _pprWriter.endUpdate();
+    }
+    
+    @Override
+    public void startUpdate(String string) throws IOException 
+    {
+      _pprWriter.startUpdate(string);
+    }
+
+    private PPRResponseWriter _pprWriter;
+  }
+  
+  /**
+   * Callback for encoding subtrees during optimized PPR tree visits
+   */
+  private static final class ExecuteAllCallback implements VisitCallback
+  {
+    public ExecuteAllCallback(
+      FacesContext context, 
+      PhaseId phaseId)
+    {
+      _context= context;
+      _phaseId = phaseId;
+    }
+    
+    public VisitResult visit(VisitContext context, UIComponent target)
+    {
+
+      // For UIViewRoot it's important to return VisitResult.ACCEPT to indicate that the tree 
+      // visit start processing its children. This is also required to not get into a recursive 
+      // hell as we got here to begin from UIViewRoot.processDecodes()
+      if (target instanceof UIViewRoot)
+        return VisitResult.ACCEPT;
+
+      // we have the subtree we want, execute it
+      if (_phaseId == PhaseId.APPLY_REQUEST_VALUES) 
+      {
+        target.processDecodes(_context);
+      } 
+      else if (_phaseId == PhaseId.PROCESS_VALIDATIONS) 
+      {
+        target.processValidators(_context);
+      } 
+      else if (_phaseId == PhaseId.UPDATE_MODEL_VALUES) 
+      {
+        target.processUpdates(_context);
+      }        
+
+      // we have finished processing desired target
+      return VisitResult.REJECT;
+    }
+    
+    private FacesContext _context;
+    private PhaseId      _phaseId;
+  }  
+  
+  private Boolean _ajaxRequest;
+  private List<String> _executeIds;
+  private FacesContext _context = null; 
+  private Boolean _partialRequest;
+  private PartialResponseWriter _partialResponseWriter;
+  private boolean _released;
+  private Boolean _renderAll;
+  private Collection<String> _renderIds;
+
+  private static final Set<VisitHint> _EXECUTE_VISIT_HINTS = EnumSet.of(VisitHint.SKIP_UNRENDERED,
+                                                                        VisitHint.EXECUTE_LIFECYCLE);  
+  
+  private static final String _RESPONSE_CONTENT_TYPE = "text/xml";
+  private static final String _FACES_REQUEST = "Faces-Request";
+  private static final String _PARTIAL_AJAX = "partial/ajax";
+  private static final String _PARTIAL_PROCESS = "partial/process";
+
+}
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
index 5e1283a..1057cda 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
@@ -143,11 +143,23 @@ public class CoreRenderKit extends RenderKitDecorator
     return "org.apache.myfaces.trinidad.core.desktop";
   }
 
+  /**
+   * Return <code>true</code> if the request header <code>Faces-Request</code> is present with the 
+   * value <code>partial/ajax</code>. Otherwise, return <code>false</code>.
+   * 
+   * @param ec the ExternalContext instance.
+   * @return
+   */
   static public boolean isAjaxRequest(ExternalContext ec)
   {
-    return "true".equals(ec.getRequestHeaderMap().get(_PPR_REQUEST_HEADER));
+    return _PARTIAL_AJAX.equals(ec.getRequestHeaderMap().get(_FACES_REQUEST_HEADER));
   }
 
+  /**
+   * TODO: Use JSF2.0 <code>Faces-Request</code> parameter.
+   * @param parameters
+   * @return
+   */
   static public boolean isPartialRequest(Map<String, String[]> parameters)
   {
     String[] array = parameters.get(_PPR_REQUEST_HEADER);
@@ -156,6 +168,11 @@ public class CoreRenderKit extends RenderKitDecorator
     return "true".equals(array[0]);
   }
 
+  /**
+   * TODO: Use JSF2.0 <code>Faces-Request</code> parameter.
+   * @param ec
+   * @return
+   */
   static public boolean isPartialRequest(ExternalContext ec)
   {
     // A partial request could be an AJAX request, or it could
@@ -803,6 +820,9 @@ public class CoreRenderKit extends RenderKitDecorator
   static private final String _SCRIPT_LIST_KEY =
     "org.apache.myfaces.trinidadinternal.renderkit.ScriptList";
   static private final String _PPR_REQUEST_HEADER = "Tr-XHR-Message";
+  private static final String _FACES_REQUEST_HEADER = "Faces-Request";
+  private static final String _PARTIAL_AJAX = "partial/ajax";
+
 
   static private final String _USE_DIALOG_POPUP_INIT_PARAM =
     "org.apache.myfaces.trinidad.ENABLE_LIGHTWEIGHT_DIALOGS";
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java
index 439affd..56c4a71 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java
@@ -23,11 +23,13 @@ import java.io.IOException;
 import java.io.Writer;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
 import javax.faces.context.ResponseWriter;
 
 import org.apache.myfaces.trinidad.context.PartialPageContext;
@@ -36,6 +38,7 @@ import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
 import org.apache.myfaces.trinidad.util.Service;
 
+import org.apache.myfaces.trinidadinternal.io.ResponseWriterDecorator;
 import org.apache.myfaces.trinidadinternal.renderkit.core.pages.GenericEntry;
 
 /**
@@ -48,7 +51,7 @@ import org.apache.myfaces.trinidadinternal.renderkit.core.pages.GenericEntry;
  * TODO: write out fragments only once we've detected the
  * ID, to avoid sending unnecessary fragments
  */
-public class PPRResponseWriter extends ScriptBufferingResponseWriter
+public class PPRResponseWriter extends ResponseWriterDecorator // ScriptBufferingResponseWriter
 {
   public PPRResponseWriter(ResponseWriter     out,
                            RenderingContext   rc)
@@ -68,7 +71,7 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
   PPRResponseWriter(ResponseWriter out,
                     PPRResponseWriter base)
   {
-    super(out, base);
+    super(out);
     // New XmlResponseWriter
     _xml        = new XmlResponseWriter(out, out.getCharacterEncoding());
     // But the rest of the state is shared
@@ -116,9 +119,10 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     // Stick another PI indicating that this is a rich reponse
     // Used for an Iframe based communication channel, since it cannot 
     // read response headers
-    _xml.write("<?Tr-XHR-Response-Type ?>\n");
+    // TODO: Do we need this?
+    // _xml.write("<?Tr-XHR-Response-Type ?>\n");
 
-    _xml.startElement("content", null);
+    _xml.startElement(_ELEMENT_PARTIAL_RESPONSE, null);
     String viewId = _facesContext.getViewRoot().getViewId();
     // HACK: don't write out an "action" for PPR on a GenericEntry page
     // (basically entirely for the InlineDatePicker case)
@@ -132,8 +136,9 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     }
 
     // TODO: Portlet support for PPR?
-
-    _xml.writeText(" ", null);
+    // TODO: PS - Not sure why this extra space is being written out, but this causes an 'malformed 
+    // XML error to be thrown by JSF 2 Ajax. Commented out the line.
+    // _xml.writeText(" ", null);
 
     _state.documentStarting = false;
   }
@@ -141,12 +146,13 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
   public void endDocument() throws IOException
   {
     // Write out any buffered <script src=""> or inline scripts
-    writeBufferedScripts();
+    // TODO: No need to write buffered scripts as we directly let script pass through
+    // writeBufferedScripts();
     
     // Write out all of the framework-level scripts
     writeFrameworkScripts();
-    
-    _xml.endElement("content");
+    _endChanges();
+    _xml.endElement(_ELEMENT_PARTIAL_RESPONSE);
     _xml.endDocument();
 
     // Force "inside target mode" - this is for Facelets,
@@ -311,9 +317,49 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     return _xml;
   }
   
+  
+  public void endUpdate() throws IOException
+  {
+    super.flush();
+
+    if (_state._allowedUpdateStarted)
+    {
+      _xml.write("]]>");
+      _xml.endElement(_ELEMENT_CHANGES_UPDATE);
+      _xml.flush();
+      _state._allowedUpdateStarted = false;
+    }
+  }
+  
+ 
+  /**
+   * Starts an update element for non-PPR based content. For e.g., for rendering out the 
+   * "javax.faces.ViewState" id.
+   * @param id the id to use for the update element
+   */
+  public void startUpdate(String id) throws IOException 
+  {
+    if (id != null && _allowedIds.contains(id))
+    {
+      _startChanges();
+      
+      if (!_state._allowedUpdateStarted)
+      {
+        _state._allowedUpdateStarted = true;
+        _xml.startElement(_ELEMENT_CHANGES_UPDATE, null);
+        _xml.writeAttribute(_ATTRIBUTE_ID, id, null);
+        _xml.write("<![CDATA[");
+        _xml.flush();
+      }
+    }
+  }  
+
+  
   /*
    * Writes out buffered inline scripts and script libraries
    */
+  
+/*  
   protected void writeBufferedScripts() throws IOException
   {
     List<String> libraries = getBufferedLibraries();
@@ -332,17 +378,18 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     {
       for (String script : scripts)
       {
-        _xml.startElement("script", null);
+        _xml.startElement(_ELEMENT_EVAL, null);
         _xml.write("<![CDATA[");
         _xml.write(script);
         _xml.write("]]>");
-        _xml.endElement("script");
+        _xml.endElement(_ELEMENT_EVAL);
       }
     }
 
     // Clear out any buffered scripts/libraries
     clearBufferedContents();
   }
+*/ 
   
   /*
    * Writes out framework-level scripts
@@ -391,7 +438,7 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     if (tag != null)
     {
       super.flush();
-      tag.start(_state.pprContext, elementName);
+      tag.startUpdate(_state.pprContext, elementName);
     }
 
     _state.componentStack.add(tag);
@@ -405,7 +452,7 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     componentStack.remove(pos);
 
     if (tag != null)
-      tag.finish(_state.pprContext, elementName);
+      tag.finishUpdate(_state.pprContext, elementName);
   }
 
   private boolean _isInsideTarget()
@@ -414,7 +461,8 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     // a partial target subtree.  Otherwise, we discard all
     // output.
     return _state.forceInsideTarget ||
-           _state.pprContext.isInsidePartialTarget();
+           _state.pprContext.isInsidePartialTarget() ||
+           _state._allowedUpdateStarted;
            
   }
 
@@ -468,7 +516,24 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     }
   }
 
+  private void _startChanges() throws IOException
+  {
+    if (!_state.changesStarted)
+    {
+      _xml.startElement(_ELEMENT_CHANGES, null);
+      _state.changesStarted = true;
+    }
+  }
 
+  private void _endChanges()
+    throws IOException
+  {
+    if (_state.changesStarted)
+    {
+      _xml.endElement("changes");
+      _state.changesStarted = false;
+    }
+  }
   //
   // Class representing PPR behavior associated with a tag.  The
   // base class simply tells PPR when it's working with a partial target
@@ -480,14 +545,16 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
       _id = id;
     }
 
-    public void start(
+    public void startUpdate(
       PartialPageContextImpl pprContext,
       String             elementName) throws IOException
     {
       if (_id != null)
       {
+        _startChanges();
         pprContext.pushRenderedPartialTarget(_id);
-        _xml.startElement("fragment",null);
+        _xml.startElement(_ELEMENT_CHANGES_UPDATE, null);
+        _xml.writeAttribute(_ATTRIBUTE_ID, _id, null);
         _xml.write("<![CDATA[");
         _xml.flush(); // NEW
 
@@ -501,7 +568,7 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
       }
     }
 
-    public void finish(
+    public void finishUpdate(
       PartialPageContextImpl pprContext,
       String             elementName) throws IOException
     {
@@ -520,7 +587,7 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
         PPRResponseWriter.super.flush();
       
         _xml.write("]]>");
-        _xml.endElement("fragment");
+        _xml.endElement(_ELEMENT_CHANGES_UPDATE);
         _xml.flush();
         
         pprContext.popRenderedPartialTarget();
@@ -567,11 +634,6 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     private String _id;
   }
 
-  
-  private State _state;
-  private ResponseWriter _xml;
-  private final FacesContext _facesContext =
-   FacesContext.getCurrentInstance();
 
   static private class State
   {
@@ -585,9 +647,22 @@ public class PPRResponseWriter extends ScriptBufferingResponseWriter
     public int           elementDepth;
     public boolean       documentStarted;
     public boolean       documentStarting;
+    public boolean       changesStarted;
+    private boolean      _allowedUpdateStarted;
     public final List<PPRTag> componentStack = new ArrayList<PPRTag>(50);
     public final PartialPageContextImpl pprContext;
   }
 
+  private State _state;
+  private ResponseWriter _xml;
+  private final FacesContext _facesContext = FacesContext.getCurrentInstance();
+  
   static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(PPRResponseWriter.class);
+  private static final String _ELEMENT_PARTIAL_RESPONSE = "partial-response";
+  private static final String _ELEMENT_CHANGES = "changes";
+  private static final String _ELEMENT_CHANGES_UPDATE = "update";
+  private static final String _ELEMENT_EVAL = "eval";
+  private static final String _ATTRIBUTE_ID = "id";
+  private static final List<String> _allowedIds = Arrays.asList(PartialResponseWriter.VIEW_STATE_MARKER);
+
 }
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandLinkRenderer.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandLinkRenderer.java
index 2101f70..6dccc87 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandLinkRenderer.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/CommandLinkRenderer.java
@@ -77,7 +77,7 @@ public class CommandLinkRenderer extends GoLinkRenderer
       Map<String, String> parameterMap =
         facesContext.getExternalContext().getRequestParameterMap();
 
-      Object source = parameterMap.get("source");
+      Object source = parameterMap.get("javax.faces.source");
       if (clientId == null)
       {
         clientId = component.getClientId(facesContext);
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java
index 059a584..2ea2efe 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/DocumentRenderer.java
@@ -20,6 +20,7 @@ package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
 import java.io.IOException;
 
+import javax.faces.application.ResourceDependency;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
@@ -34,6 +35,7 @@ import org.apache.myfaces.trinidad.render.CoreRenderer;
  * <p>
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/renderkit/core/xhtml/DocumentRenderer.java#0 $) $Date: 10-nov-2005.19:01:25 $
  */
+@ResourceDependency(target = "head", library = "javax.faces", name = "jsf.js")
 public class DocumentRenderer extends XhtmlRenderer
 {
   public DocumentRenderer()
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
index 9bc97d7..f8c9ace 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
@@ -20,6 +20,7 @@ package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
 import java.io.IOException;
 
+import javax.faces.application.ResourceDependency;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
@@ -36,6 +37,7 @@ import org.apache.myfaces.trinidad.render.CoreRenderer;
  * <p>
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/renderkit/core/xhtml/HeadRenderer.java#0 $) $Date: 10-nov-2005.19:01:29 $
  */
+@ResourceDependency(target = "head", library = "javax.faces", name = "jsf.js")
 public class HeadRenderer extends XhtmlRenderer
 {
   public HeadRenderer()
diff --git a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
index 630cf33..5364443 100644
--- a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
+++ b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
@@ -1701,7 +1701,8 @@ function submitForm(
   form,
   doValidate,
   parameters,
-  isPartial
+  isPartial,
+  event
   )
 {
   // If we've delayed any sort of event submission, we won't want to do it at
@@ -1862,7 +1863,7 @@ function submitForm(
       }
       else
       {
-        TrPage.getInstance().sendPartialFormPost(form, parameters);
+        TrPage.getInstance().sendPartialFormPost(form, parameters, null, event);
       }
     }
     else
@@ -3636,7 +3637,6 @@ function _doPprStartBlocking (win)
 //
 function _pprStopBlocking(win)
 {
-
   // No blocking is performed on Nokia, PPC and BlackBerry devices
   if (_agent.isPIE || _agent.isNokiaPhone || _agent.isBlackBerry)
     return;
@@ -3868,7 +3868,8 @@ function _firePartialChange(url)
 function _submitPartialChange(
   form,
   doValidate,
-  parameters)
+  parameters,
+  event)
 {
   // If there's no PPR iframe, then just perform a normal,
   // full-page submission.
@@ -3886,10 +3887,10 @@ function _submitPartialChange(
   parameters = _addFormParameter(parameters, "partial", "true");
 
   // block all mouse clicks until the submit is done
-    _pprStartBlocking(window);
+  _pprStartBlocking(window);
 
   // Submit the form
-  var submitted = submitForm(form, doValidate, parameters, true);
+  var submitted = submitForm(form, doValidate, parameters, true, event);
 
   // If the form wasn't actually submitted, update the ref count
   if (!submitted)
diff --git a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
index f922c55..85f418c 100644
--- a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
+++ b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
@@ -18,11 +18,15 @@
  */
 function TrPage()
 {
+  if (typeof jsf != "undefined")
+  {
+    jsf.ajax.addOnEvent(TrUIUtils.createCallback(this, this._jsfAjaxCallback));
+  }
+
   this._loadedLibraries = TrPage._collectLoadedLibraries();
   this._requestQueue = new TrRequestQueue(window);
 }
 
-
 /**
  * Get the shared instance of the page object.
  */
@@ -53,11 +57,12 @@ TrPage.prototype.getRequestQueue = function()
 TrPage.prototype.sendPartialFormPost = function(
   actionForm,
   params,
-  headerParams)
+  headerParams,
+  event)
 {
   this.getRequestQueue().sendFormPost(
     this, this._requestStatusChanged,
-    actionForm, params, headerParams);
+    actionForm, params, headerParams, event);
 }
 
 TrPage.prototype._requestStatusChanged = function(requestEvent)
@@ -67,9 +72,9 @@ TrPage.prototype._requestStatusChanged = function(requestEvent)
     var statusCode = requestEvent.getResponseStatusCode();
 
     // The server might not return successfully, for example if an
-    // exception is thrown.  When that happens, a non-200 (OK) status
-    // code is returned as part of the HTTP prototcol.
-    if (statusCode == 200)
+    // exception is thrown. When that happens, a status that is below
+    // 200 or 300 or above is returned as part of the HTTP prototcol.
+    if (statusCode >= 200 && statusCode < 300)
     {
       _pprStopBlocking(window);
 
@@ -86,7 +91,14 @@ TrPage.prototype._requestStatusChanged = function(requestEvent)
         // Nokia browser is officially supported.
         if (responseDocument != null)
         {
-          this._handlePprResponse(responseDocument.documentElement);
+          if (requestEvent.isJsfAjaxRequest())
+          {
+            this._handleJsfAjaxResponse(requestEvent);
+          }
+          else
+          {
+            this._handlePprResponse(responseDocument.documentElement);
+          }
         }
       }
       else
@@ -101,8 +113,61 @@ TrPage.prototype._requestStatusChanged = function(requestEvent)
       // wrong - we should do the handling here
       _pprStopBlocking(window);
     }
+  }
+  if (requestEvent.isJsfAjaxRequest())
+  {
+    this._handleJsfAjaxResponse(requestEvent);
+  }
+}
 
+TrPage.prototype._handleJsfAjaxResponse = function(requestEvent)
+{
+  try
+  {
+    var statusCode = requestEvent.getResponseStatusCode();
+    if (statusCode >= 200 && statusCode < 300)
+    {
+      if (this._ajaxOldDomElements)
+      {
+        this._notifyDomReplacementListeners(this._ajaxOldDomElements);
+      }
+
+      if (this._activeNode)
+      {
+        var activeNode = this._activeNode;
+        delete this._activeNode;
+        var index = -1;
+        if (activeNode.id)
+        {
+          for (var i = 0, size = this._ajaxOldDomElements.length; i < size; ++i)
+          {
+            if (TrPage._isDomAncestorOf(activeNode, this._ajaxOldDomElements[i].element))
+            {
+              index = i;
+              break;
+            }
+          }
+          if (index >= 0)
+          {
+            activeNode = document.getElementById(activeNode.id);
+            window._trActiveElement = activeNode;
+            if (activeNode)
+            {
+              activeNode.focus();
+            }
+          }
+        }
+      }
+    }
+    // TODO: do we need to do any additional processing here, for instance,
+    // error processing?
+  }
+  finally
+  {
+    delete this._ajaxOldDomElements;
+    delete this._activeNode;
   }
+  
 }
 
 TrPage.prototype._handlePprResponse = function(documentElement)
@@ -749,6 +814,7 @@ TrPage._autoSubmit = function(formId, inputId, event, validateForm, params)
 
   // If onchange is used for validation, then first validate
   // just the current input
+
   var isValid = true;
   if (_TrEventBasedValidation)
     isValid = _validateInput(event, true);
@@ -761,6 +827,92 @@ TrPage._autoSubmit = function(formId, inputId, event, validateForm, params)
     params.event = "autosub";
     params.source = inputId;
 
-    _submitPartialChange(formId, validateForm, params);
+    _submitPartialChange(formId, validateForm, params, event);
   }
 }
+
+TrPage.prototype._jsfAjaxCallback = function(data)
+{
+  if (data.status == "complete")
+  {
+    // Collect the DOM elements that will be replaced to be able to fire the
+    // DOM replacement events.
+    // This information is used in the _handleJsfAjaxResponse function that is called
+    // as a result of the request queue firing the XMLRequestEvent.
+    this._ajaxOldDomElements = this._getDomToBeUpdated(data.responseCode, data.responseXML);
+    this._activeNode = _getActiveElement();
+  }
+}
+
+TrPage.prototype._notifyDomReplacementListeners = function(dataArray)
+{
+  var listeners = this._domReplaceListeners;
+  if (!listeners || listeners.length == 0)
+  {
+    return;
+  }
+  for (var i = 0, isize = dataArray.length; i < isize; ++i)
+  {
+    var oldElem = dataArray[i].element;
+    var id = dataArray[i].id;
+    var newElem = id == null ? document.body : document.getElementById(id);
+    for (var j = 0, jsize = listeners.length; j < jsize; ++j)
+    {
+      var currListener = listeners[j];
+      var currInstance = listeners[++j];
+      if (currInstance != null)
+      {
+        currListener.call(currInstance, oldElem, newElem);
+      }
+      else
+      {
+        currListener(oldElem, newElem);
+      }
+    }
+  }
+}
+
+TrPage.prototype._getDomToBeUpdated = function(status, responseXML)
+{
+  // check for a successful request
+  if (status < 200 || status >= 300)
+  {
+    return null;
+  }
+  // see if the response contains changes (not a redirect for example)
+  var nodes = responseXML.getElementsByTagName("partial-response");
+  var responseTypeNode = nodes.length ? nodes[0].firstChild : null;
+  if (!responseTypeNode || responseTypeNode.nodeName !== "changes")
+  {
+    return null;
+  }
+
+  var changeNodes = responseTypeNode.childNodes;
+  var oldElements = [];
+  for (var i = 0, size = changeNodes.length; i < size; ++i)
+  {
+    var node = changeNodes[i];
+    if (node.nodeName !== "update")
+    {
+      // We only care about updates as that is what Trinidad supported for the DOM
+      // replacement notification API
+      continue;
+    }
+
+    var id = node.getAttribute("id");
+    if (id == "javax.faces.ViewState")
+    {
+      continue;
+    }
+    if (id == "javax.faces.ViewRoot" || id == "javax.faces.ViewBody")
+    {
+      oldElements.push({ "id": null, "element": document.body });
+    }
+    else
+    {
+      oldElements.push({ "id": id, "element": document.getElementById(id) });
+    }
+  }
+
+  return oldElements;
+}
diff --git a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
index 43d38cf..5983f48 100644
--- a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
+++ b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
@@ -31,6 +31,9 @@ function TrRequestQueue(domWindow)
 
   // Stash away the DOM window for later reference.
   this._window = domWindow;
+  // TODO: set this via a web.xml configuration parameter as well as checking for presense of the
+  // JSF library
+  this._useJsfBuiltInAjaxForXhr = (typeof jsf != "undefined");
 }
 
 // Class constants
@@ -57,7 +60,8 @@ TrRequestQueue._RequestItem = function(
   actionURL,
   headerParams,
   content,
-  method
+  method,
+  event
   )
 {
   this._type = type;
@@ -66,6 +70,7 @@ TrRequestQueue._RequestItem = function(
   this._headerParams = headerParams;
   this._content = content;
   this._method = method;
+  this._event = event;
 }
 
 TrRequestQueue.prototype._broadcastRequestStatusChanged = function(
@@ -92,11 +97,23 @@ TrRequestQueue.prototype._addRequestToQueue = function(
   listener,
   actionURL,
   content,
-  headerParams
+  headerParams,
+  event
   )
 {
   var newRequest = new TrRequestQueue._RequestItem(
-                          type, context, actionURL, headerParams, content, listener);
+                          type, context, actionURL, headerParams, content, listener, event);
+
+  if (this._useJsfBuiltInAjaxForXhr && type == TrRequestQueue._XMLHTTP_TYPE)
+  {
+    // Since JSF 2 already has a queue, we need not queue the request here, instead we should
+    // immediately process the request
+    this._state = TrRequestQueue.STATE_BUSY;
+    this._broadcastStateChangeEvent(TrRequestQueue.STATE_BUSY);
+    this._doXmlHttpRequest(newRequest);
+    return;
+  }
+
   this._requestQueue.push(newRequest);
 
   try
@@ -131,7 +148,8 @@ TrRequestQueue.prototype.sendFormPost = function(
   method,
   actionForm,
   params,
-  headerParams
+  headerParams,
+  event
   )
 {
   //this retrieves the action url for PPR.  Generally this will be the action property on
@@ -158,13 +176,24 @@ TrRequestQueue.prototype.sendFormPost = function(
   }
   else
   {
-    var content = this._getPostbackContent(actionForm, params);
-
     // IE BUG, see TRINIDAD-704
     if(_agent.isIE)
       this._autoCompleteForm(actionForm);
 
-    this.sendRequest(context, method, action, content, headerParams);
+    if (this._useJsfBuiltInAjaxForXhr)
+    {
+      // JSF 2 AJAX will take the parameters and it will determine the form
+      // content itself, so we should not convert the data to a string or
+      // gather the form values
+      // TODO: log a warning if we're dropping any headers?  Or
+      // come up with a hack to send "headers" via a multipart request?
+      this.sendRequest(context, method, action, params, headerParams, event);
+    }
+    else
+    {
+      var content = this._getPostbackContent(actionForm, params);
+      this.sendRequest(context, method, action, content, headerParams, event);
+    }
   }
 }
 
@@ -349,22 +378,25 @@ TrRequestQueue._appendUrlFormEncoded = function(
 
 /**
 * Performs Asynchronous XML HTTP Request with the Server
-* @param context    any object that is sent back to the callback when the request
+* @param context Any object that is sent back to the callback when the request
 *  is complete. This object can be null.
-* @param method   Javascript method
-* @param actionURL   the url to send the request to
-* @param headerParams  Option HTTP header parameters to attach to the request
-* @param content     the content of the Asynchronous XML HTTP Post
+* @param method Javascript method
+* @param actionURL The url to send the request to
+* @param headerParams Option HTTP header parameters to attach to the request
+* @param content The content of the Asynchronous XML HTTP Post
+* @param event The browser event that triggered the request, if any
 */
 TrRequestQueue.prototype.sendRequest = function(
   context,
   method,
   actionURL,
   content,
-  headerParams
+  headerParams,
+  event
   )
 {
-  this._addRequestToQueue(TrRequestQueue._XMLHTTP_TYPE, context, method, actionURL, content, headerParams);
+  this._addRequestToQueue(TrRequestQueue._XMLHTTP_TYPE, context, method, actionURL, content,
+    headerParams, event);
 }
 
 /**
@@ -411,30 +443,42 @@ TrRequestQueue.prototype._doRequest = function()
 
 TrRequestQueue.prototype._doXmlHttpRequest = function(requestItem)
 {
-  var xmlHttp = new TrXMLRequest();
+  var xmlHttp;
+  if (this._useJsfBuiltInAjaxForXhr)
+  {
+    xmlHttp = new TrXMLJsfAjaxRequest(requestItem._event, requestItem._content);
+  }
+  else
+  {
+    xmlHttp = new TrXMLRequest();
+  }
+
   xmlHttp.__dtsRequestContext = requestItem._context;
   xmlHttp.__dtsRequestMethod = requestItem._method;
   var callback = TrUIUtils.createCallback(this, this._handleRequestCallback);
   xmlHttp.setCallback(callback);
 
-  // xmlhttp request uses the same charset as its parent document's charset.
-  // There is no need to set the charset.
-  xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+  if (!this._useJsfBuiltInAjaxForXhr)
+  {
+    // xmlhttp request uses the same charset as its parent document's charset.
+    // There is no need to set the charset.
+    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
 
-  var headerParams = requestItem._headerParams;
+    var headerParams = requestItem._headerParams;
 
-  if (headerParams != null)
-  {
-    for (var headerName in headerParams)
+    if (headerParams != null)
     {
-      var currHeader =  headerParams[headerName];
+      for (var headerName in headerParams)
+      {
+        var currHeader =  headerParams[headerName];
 
-      // handle array parameters by joining them together with comma separators
-      // Test if it's an array via the "join" method
-      if (currHeader["join"])
-        currHeader = currHeader.join(',')
+        // handle array parameters by joining them together with comma separators
+        // Test if it's an array via the "join" method
+        if (currHeader["join"])
+          currHeader = currHeader.join(',')
 
-      xmlHttp.setRequestHeader(headerName, currHeader);
+        xmlHttp.setRequestHeader(headerName, currHeader);
+      }
     }
   }
 
@@ -684,7 +728,7 @@ TrRequestQueue.prototype._handleRequestCallback = function(
     // the Http connection  has been closed
   }
 
-  if ((statusCode != 200) && (statusCode != 0))
+  if ((statusCode < 200 || statusCode >= 300) && (statusCode != 0))
   {
     TrRequestQueue._alertError();
     TrRequestQueue._logError("Error StatusCode(",
diff --git a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js
index f78fedb..b6ca382 100644
--- a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js
+++ b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequest.js
@@ -6,9 +6,9 @@
  *  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
@@ -34,7 +34,6 @@ function TrXMLRequest()
   this.xmlhttp = TrXMLRequest._createXmlHttpRequest();
 }
 
-
 /**
 * Request state constants. See getCompletionState()
 **/
@@ -49,7 +48,7 @@ TrXMLRequest.COMPLETED = 4;
 * Parameters: isSynch - true if request should be synchronous,
 * false otherwise
 **/
-TrXMLRequest.prototype.setSynchronous = 
+TrXMLRequest.prototype.setSynchronous =
 function (isSynch)
 {
   this.isSynchronous = isSynch;
@@ -62,7 +61,7 @@ function (isSynch)
 * The callback should have the following siganture:
 * <void> function (<TrXMLRequest>request)
 **/
-TrXMLRequest.prototype.setCallback = 
+TrXMLRequest.prototype.setCallback =
 function (_callback)
 {
   this.callback = _callback;
@@ -92,7 +91,7 @@ function()
 * Note: this method will block if the the request is asynchronous and
 * has not yet been completed
 **/
-TrXMLRequest.prototype.getResponseXML = 
+TrXMLRequest.prototype.getResponseXML =
 function()
 {
   return this.xmlhttp.responseXML;
@@ -103,7 +102,7 @@ function()
 * Note: this method will block if the the request is asynchronous and
 * has not yet been completed
 **/
-TrXMLRequest.prototype.getResponseText = 
+TrXMLRequest.prototype.getResponseText =
 function()
 {
   return this.xmlhttp.responseText;
@@ -111,7 +110,7 @@ function()
 
 /**
 * Sends an XML HTTP request
-* Parameters: 
+* Parameters:
 * url - destination URL
 * content - XML document or string that should be included in the request's body
 **/
@@ -125,7 +124,7 @@ function(url, content)
     cb.obj = this;
     xmlhttp.onreadystatechange  = cb;
   }
-  
+
   var method = content ? "POST" : "GET";
   xmlhttp.open(method, url, !this.isSynchronous);
   for (var name in this.headers)
@@ -144,20 +143,20 @@ function(url, content)
 }
 
 
-TrXMLRequest.prototype.getResponseHeader = 
+TrXMLRequest.prototype.getResponseHeader =
 function(name)
 {
 
   return this.xmlhttp.getResponseHeader(name);
 }
 
-TrXMLRequest.prototype.getAllResponseHeaders = 
+TrXMLRequest.prototype.getAllResponseHeaders =
 function()
 {
   return this.xmlhttp.getAllResponseHeaders();
 }
 
-TrXMLRequest.prototype.setRequestHeader = 
+TrXMLRequest.prototype.setRequestHeader =
 function(name, value)
 {
   this.headers[name] = value;
@@ -206,4 +205,117 @@ TrXMLRequest.prototype.cleanup =function()
   delete this.xmlhttp;
 }
 
+/**
+ * Wrapper for the JSF AJAX callback data that provides the same
+ * interface as TrXMLRequest to maintain a compatible API to ease
+ * the support of both the legacy code as well as code to integrate
+ * with JSF 2 AJAX
+ */
+function TrXMLJsfAjaxRequest(
+  event,
+  params)
+{
+  this.isSynchronous = false;
+  this.callback = null;
+  this._event = event;
+  this._params = params || new Object();
+  this._status = 0;
+  this._state = TrXMLRequest.UNINITIALIZED;
+}
+TrXMLJsfAjaxRequest.prototype.setCallback = function(value)
+{
+  this.callback = value;
+}
+TrXMLJsfAjaxRequest.prototype.getCompletionState = function()
+{
+  return this._state;
+}
+TrXMLJsfAjaxRequest.prototype.getStatus = function()
+{
+  return this._status;
+}
+TrXMLJsfAjaxRequest.prototype.getResponseXML = function()
+{
+  return this._responseXML;
+}
+TrXMLJsfAjaxRequest.prototype.getResponseText = function()
+{
+  return this._responseText;
+}
+TrXMLJsfAjaxRequest.prototype.cleanup = function()
+{
+  this.callback = null;
+}
+TrXMLJsfAjaxRequest.prototype._ajaxCallback = function(
+  data
+  )
+{
+  switch (data.status)
+  {
+    case "begin":
+      this._state = TrXMLRequest.LOADING;
+      break;
+    case "complete":
+      this._state = TrXMLRequest.LOADED;
+      break;
+    case "success":
+    default:
+      this._state = TrXMLRequest.COMPLETED;
+      break;
+  }
+
+  if (data.status != "begin")
+  {
+    this._status = data.responseCode;
+    this._responseXML = data.responseXML;
+    this._responseText = data.responseText;
+  }
+
+  if (this.callback)
+  {
+    this.callback(this);
+  }
+}
+TrXMLJsfAjaxRequest.prototype.__onerror = function(
+  data
+  )
+{
+  this._state = TrXMLRequest.COMPLETED;
+  this._status = data.responseCode;
+  this._responseXML = data.responseXML;
+  this._responseText = data.responseText;
+  if (this.callback)
+  {
+    this.callback(this);
+  }
+}
+TrXMLJsfAjaxRequest.prototype.send = function()
+{
+  var source = this._params.source ?
+    _getElementById(window.document, this._params.source) : null;
+
+  var ajaxCallback = TrUIUtils.createCallback(this, this._ajaxCallback);
 
+  jsf.ajax.request(
+    source,
+    this._event,
+    {
+      "onevent": ajaxCallback,
+      "onerror": ajaxCallback,
+      "params": this._params
+    });
+
+  // No need for the event anymore, release the resource
+  delete this._event;
+}
+// No-op functions:
+TrXMLJsfAjaxRequest.prototype.setSynchronous =
+TrXMLJsfAjaxRequest.prototype.setRequestHeader = function() {}
+TrXMLJsfAjaxRequest.prototype.getAllResponseHeaders = function()
+{
+  return new Object();
+};
+TrXMLJsfAjaxRequest.prototype.getResponseHeader = function()
+{
+  return null;
+};
\ No newline at end of file
diff --git a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequestEvent.js b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequestEvent.js
index 56eb95b..ed669d9 100644
--- a/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequestEvent.js
+++ b/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/XMLRequestEvent.js
@@ -6,9 +6,9 @@
  *  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
@@ -20,7 +20,7 @@
 /**
  * AJAX Request Event class. This object is passed back to the listeners
  * of a AJAX Service Request. It support ITrXMLRequestEvent pseudo-interface
- * with the following methods: getStatus, getResponseXML, getResponseText, 
+ * with the following methods: getStatus, getResponseXML, getResponseText,
  * isPprResponse, getResponseContentType
  */
 function TrXMLRequestEvent(
@@ -56,7 +56,7 @@ TrXMLRequestEvent.prototype.getResponseXML = function()
 * NOTE: this method is valid only for TrXMLRequestEvent.STATUS_COMPLETE
 **/
 TrXMLRequestEvent.prototype._isResponseValidXML = function()
-{         
+{
   // Note: Mozilla applies default XSLT to XML parse error
   var responseDocument = this._request.getResponseXML();
   if (!responseDocument)
@@ -81,7 +81,7 @@ TrXMLRequestEvent.prototype._isResponseValidXML = function()
 * NOTE: this method is valid only for TrXMLRequestEvent.STATUS_COMPLETE
 **/
 TrXMLRequestEvent.prototype.getResponseText = function()
-{  
+{
   return this._request.getResponseText();
 }
 
@@ -147,4 +147,12 @@ TrXMLRequestEvent.prototype.isPprResponse = function()
 TrXMLRequestEvent.prototype.getResponseContentType = function()
 {
   this.getResponseHeader("Content-Type");
-}
\ No newline at end of file
+}
+
+/**
+ * Returns if the request was made by the built in JSF AJAX APIs
+ */
+TrXMLRequestEvent.prototype.isJsfAjaxRequest = function()
+{
+  return (this._request instanceof TrXMLJsfAjaxRequest);
+};
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.