You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2019/01/24 15:14:17 UTC
[myfaces] branch master updated: MYFACES-4265: adding body
replacement on a full response.
This is an automated email from the ASF dual-hosted git repository.
werpu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/master by this push:
new 50c22b9 MYFACES-4265: adding body replacement on a full response.
50c22b9 is described below
commit 50c22b9642cf1b16a59ed88f3f5f043e41aae2e1
Author: Werner Punz <we...@gmail.com>
AuthorDate: Thu Jan 24 15:59:33 2019 +0100
MYFACES-4265: adding body replacement on a full response.
---
.../main/webapp/test5-viewbody-full-response.xhtml | 48 ++++++++++++++++++++++
.../integrationtests/ajax/IntegrationTest.java | 7 ++++
2 files changed, 55 insertions(+)
diff --git a/integration-tests/ajax/src/main/webapp/test5-viewbody-full-response.xhtml b/integration-tests/ajax/src/main/webapp/test5-viewbody-full-response.xhtml
new file mode 100644
index 0000000..52998f7
--- /dev/null
+++ b/integration-tests/ajax/src/main/webapp/test5-viewbody-full-response.xhtml
@@ -0,0 +1,48 @@
+<!--
+ 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 html>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://xmlns.jcp.org/jsf/html"
+>
+
+<h:head>
+ <title>test</title>
+ <h:outputScript library="javax.faces" name="jsf.js"/>
+ <script type="text/javascript" src="./scripts/testhelpers.js"></script>
+
+</h:head>
+
+<h:body>
+ <h1>View Body replacement in Full Page Response</h1>
+
+ <h2>
+ Normally we only get a subset of a page, however it is theoretically
+ possible to send a full page and replace only the head or body instead
+ of just the entire page. (This is a possible corner condition of the protocol)
+ Not sure if this is ever used but nevertheless the codebase has react to this condition.
+ </h2>
+
+
+ <h:form id="form1" prependId="false">
+ <input type="button" id="cmd_body1" value="replace the entire body"
+ onclick="emitPPR(this, ('undefined' == typeof event)? null: event, 'body');"/>
+ </h:form>
+
+</h:body>
+</html>
\ No newline at end of file
diff --git a/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java b/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
index 6edebe6..a7793f2 100644
--- a/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
+++ b/integration-tests/ajax/src/test/java/org/apache/myfaces/core/integrationtests/ajax/IntegrationTest.java
@@ -282,6 +282,13 @@ public class IntegrationTest {
}
+ @Test
+ public void testViewRootBodyReplacement() {
+ webDriver.get(contextPath + "test5-viewbody-full-response.jsf");
+ resetServerValues();
+ trigger("cmd_body1", webDriver1 -> webDriver1.getPageSource().contains("Test for body change done") &&
+ webDriver1.findElement(new By.ById("scriptreceiver")).getText().contains("hello from embedded script & in the body"));
+ }
/**
* recurring trigger, wait until ajax processing is done function