[struts] branch master updated (54b1568 -> 8896015)

2020-08-16 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git.


from 54b1568  Merge pull request #428 from 
JCgH4164838Gh792C124B5/WW-5083_Followup
 new c1180e2  initial implementation of coop
 new 529ec1e  WW-5085: Initial implementation of Cross-Origin Opener Policy 
and Cross-Origin Embedder Policy interceptors
 new 4acaccf  Merge branch 'master' into coop-coep-post
 new 8896015  Merge pull request #432 from salcho/coop-coep-post

The 5945 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.


Summary of changes:
 .../struts2/interceptor/CoepInterceptor.java   | 91 
 .../struts2/interceptor/CoopInterceptor.java   | 92 +
 core/src/main/resources/struts-default.xml | 11 +++
 .../struts2/interceptor/CoepInterceptorTest.java   | 96 ++
 .../struts2/interceptor/CoopInterceptorTest.java   | 90 
 5 files changed, 380 insertions(+)
 create mode 100644 
core/src/main/java/org/apache/struts2/interceptor/CoepInterceptor.java
 create mode 100644 
core/src/main/java/org/apache/struts2/interceptor/CoopInterceptor.java
 create mode 100644 
core/src/test/java/org/apache/struts2/interceptor/CoepInterceptorTest.java
 create mode 100644 
core/src/test/java/org/apache/struts2/interceptor/CoopInterceptorTest.java



[struts] branch struts-2-5-x updated: WW-5086 Fixes s:set tag with empty body

2020-08-16 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/struts-2-5-x by this push:
 new 1191ca3  WW-5086 Fixes s:set tag with empty body
1191ca3 is described below

commit 1191ca3ed091d350bc3fce12230ab07de81304de
Author: Lukasz Lenart 
AuthorDate: Mon Aug 17 08:30:56 2020 +0200

WW-5086 Fixes s:set tag with empty body
---
 core/src/main/java/org/apache/struts2/components/Set.java  |  9 ++---
 .../test/java/org/apache/struts2/views/jsp/SetTagTest.java | 14 ++
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/components/Set.java 
b/core/src/main/java/org/apache/struts2/components/Set.java
index a8233b9..fb2a366 100644
--- a/core/src/main/java/org/apache/struts2/components/Set.java
+++ b/core/src/main/java/org/apache/struts2/components/Set.java
@@ -31,8 +31,7 @@ import com.opensymphony.xwork2.util.ValueStack;
  * complex expression and then simply reference that variable each time rather 
than the complex expression. This is
  * useful in both cases: when the complex expression takes time (performance 
improvement) or is hard to read (code
  * readability improvement).
- * If the tag is used with body content, the evaluation of the value 
parameter is omitted. Instead, the String to
- * which the body evaluates is set as value for the scoped variable.
+ * If the value parameter is omitted, the String to which the body 
evaluates is set as value for the scoped variable.
  *
  * The scopes available are as follows:
  * 
@@ -94,11 +93,7 @@ public class Set extends ContextBean {
 
 Object o;
 if (value == null) {
-if (body != null && !body.equals("")) {
-o = body;
-} else {
-o = findValue("top");
-}
+o = body;
 } else {
 o = findValue(value);
 }
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java 
b/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java
index 16e56f2..5edfae4 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java
@@ -121,6 +121,20 @@ public class SetTagTest extends AbstractUITagTest {
 assertEquals(beginEndSpaceString, context.get("foo"));
 }
 
+public void testEmptyBody() throws JspException {
+StrutsMockBodyContent mockBodyContent;
+String variableName = "foo";
+tag.setName(variableName);
+tag.setValue(null);
+mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
+String emptyBody = "";
+mockBodyContent.setString(emptyBody);
+tag.setBodyContent(mockBodyContent);
+tag.doStartTag();
+tag.doEndTag();
+assertEquals(emptyBody, context.get(variableName));
+}
+
 protected void setUp() throws Exception {
 super.setUp();
 



[struts] branch master updated: WW-5086 Fixes s:set tag with empty body

2020-08-16 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/master by this push:
 new 6df90bf  WW-5086 Fixes s:set tag with empty body
6df90bf is described below

commit 6df90bff3b1734274983dcf1ffc7567d219ff54d
Author: Lukasz Lenart 
AuthorDate: Mon Aug 17 08:30:56 2020 +0200

WW-5086 Fixes s:set tag with empty body
---
 core/src/main/java/org/apache/struts2/components/Set.java  |  9 ++---
 .../test/java/org/apache/struts2/views/jsp/SetTagTest.java | 14 ++
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/components/Set.java 
b/core/src/main/java/org/apache/struts2/components/Set.java
index a8233b9..fb2a366 100644
--- a/core/src/main/java/org/apache/struts2/components/Set.java
+++ b/core/src/main/java/org/apache/struts2/components/Set.java
@@ -31,8 +31,7 @@ import com.opensymphony.xwork2.util.ValueStack;
  * complex expression and then simply reference that variable each time rather 
than the complex expression. This is
  * useful in both cases: when the complex expression takes time (performance 
improvement) or is hard to read (code
  * readability improvement).
- * If the tag is used with body content, the evaluation of the value 
parameter is omitted. Instead, the String to
- * which the body evaluates is set as value for the scoped variable.
+ * If the value parameter is omitted, the String to which the body 
evaluates is set as value for the scoped variable.
  *
  * The scopes available are as follows:
  * 
@@ -94,11 +93,7 @@ public class Set extends ContextBean {
 
 Object o;
 if (value == null) {
-if (body != null && !body.equals("")) {
-o = body;
-} else {
-o = findValue("top");
-}
+o = body;
 } else {
 o = findValue(value);
 }
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java 
b/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java
index 16e56f2..5edfae4 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java
@@ -121,6 +121,20 @@ public class SetTagTest extends AbstractUITagTest {
 assertEquals(beginEndSpaceString, context.get("foo"));
 }
 
+public void testEmptyBody() throws JspException {
+StrutsMockBodyContent mockBodyContent;
+String variableName = "foo";
+tag.setName(variableName);
+tag.setValue(null);
+mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
+String emptyBody = "";
+mockBodyContent.setString(emptyBody);
+tag.setBodyContent(mockBodyContent);
+tag.doStartTag();
+tag.doEndTag();
+assertEquals(emptyBody, context.get(variableName));
+}
+
 protected void setUp() throws Exception {
 super.setUp();