(struts) branch main updated: Adjusts required checks to the new structure (#1264)

2025-05-07 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new a7d915d62 Adjusts required checks to the new structure (#1264)
a7d915d62 is described below

commit a7d915d6279c142b80dd28244fbc99e205c35464
Author: Lukasz Lenart 
AuthorDate: Thu May 8 06:52:33 2025 +0200

Adjusts required checks to the new structure (#1264)

more details can be found here 
https://github.com/apache/infrastructure-asfyaml/blob/main/README.md#branch-protection
---
 .asf.yaml | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/.asf.yaml b/.asf.yaml
index 6bcfc98d7..cf3c0ff27 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -17,16 +17,18 @@ github:
   protected_branches:
 main:
   # contexts are the names of checks that must pass.
-  contexts:
-- build
+  required_status_checks:
+contexts:
+  - build
   required_pull_request_reviews:
 # it does not work because our github teams are private/secret, see 
INFRA-25666
 require_code_owner_reviews: false
 required_approving_review_count: 0
 release/struts-6-7-x:
   # contexts are the names of checks that must pass.
-  contexts:
-- build
+  required_status_checks:
+contexts:
+  - build
   required_pull_request_reviews:
 # it does not work because our github teams are private/secret, see 
INFRA-25666
 require_code_owner_reviews: false



(struts) branch fix/contexts deleted (was daebe597a)

2025-05-07 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

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


 was daebe597a Adjusts required checks to the new structure more details 
can be found here 
https://github.com/apache/infrastructure-asfyaml/blob/main/README.md#branch-protection

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(struts) 01/01: WW-5548 Defines proper request attributes when forwarding or including final path

2025-05-07 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch fix/WW-5548-forward
in repository https://gitbox.apache.org/repos/asf/struts.git

commit ab727f3d16b38953dd35219f3e7d4e0abd594e18
Author: Lukasz Lenart 
AuthorDate: Thu May 8 07:58:19 2025 +0200

WW-5548 Defines proper request attributes when forwarding or including 
final path
---
 .../struts2/result/ServletDispatcherResult.java| 30 ++--
 .../result/ServletDispatcherResultTest.java| 33 ++
 2 files changed, 49 insertions(+), 14 deletions(-)

diff --git 
a/core/src/main/java/org/apache/struts2/result/ServletDispatcherResult.java 
b/core/src/main/java/org/apache/struts2/result/ServletDispatcherResult.java
index feced67bb..3d8aeb8f3 100644
--- a/core/src/main/java/org/apache/struts2/result/ServletDispatcherResult.java
+++ b/core/src/main/java/org/apache/struts2/result/ServletDispatcherResult.java
@@ -18,8 +18,6 @@
  */
 package org.apache.struts2.result;
 
-import org.apache.struts2.ActionInvocation;
-import org.apache.struts2.inject.Inject;
 import jakarta.servlet.RequestDispatcher;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
@@ -28,9 +26,11 @@ import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.apache.struts2.ActionInvocation;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsStatics;
 import org.apache.struts2.dispatcher.HttpParameters;
+import org.apache.struts2.inject.Inject;
 import org.apache.struts2.url.QueryStringParser;
 
 import java.io.Serial;
@@ -158,13 +158,6 @@ public class ServletDispatcherResult extends 
StrutsResultSupport {
 //if we are inside an action tag, we always need to do an include
 boolean insideActionTag = (Boolean) 
ObjectUtils.defaultIfNull(request.getAttribute(StrutsStatics.STRUTS_ACTION_TAG_INVOCATION),
 Boolean.FALSE);
 
-// this should allow integration with third-party view related 
frameworks
-if (finalLocation.contains("?")) {
-request.setAttribute(RequestDispatcher.FORWARD_SERVLET_PATH, 
finalLocation.substring(0, finalLocation.indexOf('?')));
-} else {
-request.setAttribute(RequestDispatcher.FORWARD_SERVLET_PATH, 
finalLocation);
-}
-
 // If we're included, then include the view
 // Otherwise do forward
 // This allow the page to, for example, set content type
@@ -173,9 +166,28 @@ public class ServletDispatcherResult extends 
StrutsResultSupport {
 request.setAttribute("struts.view_uri", finalLocation);
 request.setAttribute("struts.request_uri", 
request.getRequestURI());
 
+// These attributes are required when forwarding to another 
servlet, see specification:
+// 
https://jakarta.ee/specifications/servlet/6.0/jakarta-servlet-spec-6.0#forwarded-request-parameters
+request.setAttribute(RequestDispatcher.FORWARD_MAPPING, 
request.getHttpServletMapping());
+request.setAttribute(RequestDispatcher.FORWARD_REQUEST_URI, 
request.getRequestURI());
+request.setAttribute(RequestDispatcher.FORWARD_CONTEXT_PATH, 
request.getContextPath());
+request.setAttribute(RequestDispatcher.FORWARD_SERVLET_PATH, 
request.getServletPath());
+request.setAttribute(RequestDispatcher.FORWARD_PATH_INFO, 
request.getPathInfo());
+request.setAttribute(RequestDispatcher.FORWARD_QUERY_STRING, 
request.getQueryString());
+
 dispatcher.forward(request, response);
 } else {
 LOG.debug("Including location: {}", finalLocation);
+
+// These attributes are required when forwarding to another 
servlet, see specification:
+// 
https://jakarta.ee/specifications/servlet/6.0/jakarta-servlet-spec-6.0#included-request-parameters
+request.setAttribute(RequestDispatcher.INCLUDE_MAPPING, 
request.getHttpServletMapping());
+request.setAttribute(RequestDispatcher.INCLUDE_REQUEST_URI, 
request.getRequestURI());
+request.setAttribute(RequestDispatcher.INCLUDE_CONTEXT_PATH, 
request.getContextPath());
+request.setAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH, 
request.getServletPath());
+request.setAttribute(RequestDispatcher.INCLUDE_PATH_INFO, 
request.getPathInfo());
+request.setAttribute(RequestDispatcher.INCLUDE_QUERY_STRING, 
request.getQueryString());
+
 dispatcher.include(request, response);
 }
 }
diff --git 
a/core/src/test/java/org/apache/struts2/result/ServletDispatcherResultTest.java 
b/core/src/test/java/org/apache/struts2/result/Se

(struts) branch fix/WW-5548-forward created (now ab727f3d1)

2025-05-07 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch fix/WW-5548-forward
in repository https://gitbox.apache.org/repos/asf/struts.git


  at ab727f3d1 WW-5548 Defines proper request attributes when forwarding or 
including final path

This branch includes the following new commits:

 new ab727f3d1 WW-5548 Defines proper request attributes when forwarding or 
including final path

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




(struts) branch fix/WW-5548-forward updated (ab727f3d1 -> 95183cddf)

2025-05-07 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch fix/WW-5548-forward
in repository https://gitbox.apache.org/repos/asf/struts.git


from ab727f3d1 WW-5548 Defines proper request attributes when forwarding or 
including final path
 add 95183cddf Fies typo

No new revisions were added by this update.

Summary of changes:
 .../main/java/org/apache/struts2/result/ServletDispatcherResult.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)