(struts) 01/01: Revert "WW-5251 remove deprecated interfaces related to ServletConfigInterceptor"
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch revert-670-issue/WW-5251 in repository https://gitbox.apache.org/repos/asf/struts.git commit a4cf02ab96f4d0a02ff2bac3be51db57399db276 Author: Lukasz Lenart AuthorDate: Tue Mar 26 09:02:54 2024 +0100 Revert "WW-5251 remove deprecated interfaces related to ServletConfigInterceptor" --- .../struts2/showcase/chat/ChatLoginAction.java | 13 +- .../struts2/showcase/chat/ChatLogoutAction.java| 13 +- .../struts2/showcase/chat/EnterRoomAction.java | 14 +- .../struts2/showcase/chat/ExitRoomAction.java | 13 +- .../showcase/chat/SendMessageToRoomAction.java | 12 +- .../showcase/hangman/GetUpdatedHangmanAction.java | 14 +- .../showcase/hangman/GuessCharacterAction.java | 14 +- .../showcase/hangman/StartHangmanAction.java | 13 +- .../apache/struts2/showcase/xslt/JVMAction.java| 13 +- .../apache/struts2/dispatcher/HttpParameters.java | 7 + .../struts2/interceptor/ApplicationAware.java | 45 + .../struts2/interceptor/HttpParametersAware.java | 49 ++ .../apache/struts2/interceptor/ParameterAware.java | 50 ++ .../apache/struts2/interceptor/PrincipalAware.java | 38 .../apache/struts2/interceptor/RequestAware.java | 58 +++ .../interceptor/ServletConfigInterceptor.java | 85 +++-- .../struts2/interceptor/ServletRequestAware.java | 49 ++ .../struts2/interceptor/ServletResponseAware.java | 47 + .../apache/struts2/interceptor/SessionAware.java | 47 + .../apache/struts2/util/ServletContextAware.java | 36 .../interceptor/ServletConfigInterceptorTest.java | 192 +++-- .../dispatcher/DirectRenderFromEventAction.java| 10 +- .../interceptor/PortletAwareInterceptor.java | 50 -- .../portlet/interceptor/PortletContextAware.java | 34 .../interceptor/PortletPreferencesAware.java | 42 + .../portlet/interceptor/PortletRequestAware.java | 35 .../portlet/interceptor/PortletResponseAware.java | 35 .../interceptor/PortletAwareInterceptorTest.java | 31 +++- .../interceptor/PortletStateInterceptorTest.java | 6 +- 29 files changed, 912 insertions(+), 153 deletions(-) diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java index 0dcfd8943..a5fc15e73 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java @@ -21,17 +21,16 @@ package org.apache.struts2.showcase.chat; import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.interceptor.SessionAware; import java.util.Map; -import org.apache.struts2.action.SessionAware; - public class ChatLoginAction extends ActionSupport implements SessionAware { private static final long serialVersionUID = 1L; private ChatService chatService; - private Map session; + private Map session; private String name; @@ -61,8 +60,8 @@ public class ChatLoginAction extends ActionSupport implements SessionAware { } -@Override -public void withSession(Map session) { -this.session = session; -} + // === SessionAware === + public void setSession(Map session) { + this.session = session; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java index 452ce0d08..d0c3e6ba6 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java @@ -21,18 +21,17 @@ package org.apache.struts2.showcase.chat; import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.interceptor.SessionAware; import java.util.Map; -import org.apache.struts2.action.SessionAware; - public class ChatLogoutAction extends ActionSupport implements SessionAware { private static final long serialVersionUID = 1L; private ChatService chatService; - private Map session; + private Map session; public ChatLogoutAction(ChatService chatService) { @@ -51,8 +50,8 @@ public class ChatLogoutAction extends ActionSupport implements SessionAware { } -@Override -public void withSession(Map session) { -this.session = session; -} + // === SessionAware === + public void setSession(Map session) { + this.session = session; + } } diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomA
(struts) branch revert-670-issue/WW-5251 created (now a4cf02ab9)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch revert-670-issue/WW-5251 in repository https://gitbox.apache.org/repos/asf/struts.git at a4cf02ab9 Revert "WW-5251 remove deprecated interfaces related to ServletConfigInterceptor" This branch includes the following new commits: new a4cf02ab9 Revert "WW-5251 remove deprecated interfaces related to ServletConfigInterceptor" 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 revert-670-issue/WW-5251 updated: WW-5251 Fixes compilation errors in test
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch revert-670-issue/WW-5251 in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/revert-670-issue/WW-5251 by this push: new 21af6e597 WW-5251 Fixes compilation errors in test 21af6e597 is described below commit 21af6e597bebe42e6aca9f45677ae0459c226879 Author: Lukasz Lenart AuthorDate: Tue Mar 26 09:09:56 2024 +0100 WW-5251 Fixes compilation errors in test --- .../interceptor/ServletConfigInterceptorTest.java | 35 ++ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java index 3cefbf18c..ec3f07e79 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java @@ -31,9 +31,6 @@ import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; @@ -51,14 +48,14 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { private ServletConfigInterceptor interceptor; public void testServletRequestAware() throws Exception { -ServletRequestAware mock = (ServletRequestAware) createMock(ServletRequestAware.class); +ServletRequestAware mock = createMock(ServletRequestAware.class); MockHttpServletRequest req = new MockHttpServletRequest(); MockActionInvocation mai = createActionInvocation(mock); mai.getInvocationContext().put(StrutsStatics.HTTP_REQUEST, req); -mock.setServletRequest((HttpServletRequest) req); +mock.setServletRequest(req); expectLastCall(); replay(mock); @@ -83,14 +80,14 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { } public void testServletResponseAware() throws Exception { -ServletResponseAware mock = (ServletResponseAware) createMock(ServletResponseAware.class); +ServletResponseAware mock = createMock(ServletResponseAware.class); MockHttpServletResponse res = new MockHttpServletResponse(); MockActionInvocation mai = createActionInvocation(mock); mai.getInvocationContext().put(StrutsStatics.HTTP_RESPONSE, res); -mock.setServletResponse((HttpServletResponse) res); +mock.setServletResponse(res); expectLastCall().times(1); replay(mock); @@ -120,7 +117,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { MockActionInvocation mai = createActionInvocation(mock); HttpParameters param = HttpParameters.create().build(); -mai.getInvocationContext().setParameters(param); +mai.getInvocationContext().withParameters(param); param.applyParameters(mock); expectLastCall().times(1); @@ -136,7 +133,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { MockActionInvocation mai = createActionInvocation(mock); HttpParameters param = HttpParameters.create().build(); -mai.getInvocationContext().setParameters(param); +mai.getInvocationContext().withParameters(param); mock.setParameters(param); expectLastCall().times(1); @@ -163,12 +160,12 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { } public void testSessionAware() throws Exception { -SessionAware mock = (SessionAware) createMock(SessionAware.class); +SessionAware mock = createMock(SessionAware.class); MockActionInvocation mai = createActionInvocation(mock); -Map session = new HashMap(); -mai.getInvocationContext().setSession(session); +Map session = new HashMap<>(); +mai.getInvocationContext().withSession(session); mock.setSession(session); expectLastCall().times(1); @@ -183,7 +180,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { MockActionInvocation mai = createActionInvocation(mock); -Map session = new HashMap(); +Map session = new HashMap<>(); mai.getInvocationContext().withSession(session); mock.withSession(session); @@ -199,7 +196,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { MockActionInvocation mai = createActionInvocation(mock); -Map app = new HashMap(); +Map app = new HashMap<>(); mai.getIn
(struts) 01/01: WW-5251 Fixes compilation errors in test
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch revert-670-issue/WW-5251 in repository https://gitbox.apache.org/repos/asf/struts.git commit 2bba8ccd3e33101046970edf4732d937d2226037 Author: Lukasz Lenart AuthorDate: Tue Mar 26 09:09:56 2024 +0100 WW-5251 Fixes compilation errors in test --- .../interceptor/ServletConfigInterceptorTest.java | 35 ++ .../interceptor/PortletStateInterceptorTest.java | 6 ++-- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java index 3cefbf18c..ec3f07e79 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ServletConfigInterceptorTest.java @@ -31,9 +31,6 @@ import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletContext; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; @@ -51,14 +48,14 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { private ServletConfigInterceptor interceptor; public void testServletRequestAware() throws Exception { -ServletRequestAware mock = (ServletRequestAware) createMock(ServletRequestAware.class); +ServletRequestAware mock = createMock(ServletRequestAware.class); MockHttpServletRequest req = new MockHttpServletRequest(); MockActionInvocation mai = createActionInvocation(mock); mai.getInvocationContext().put(StrutsStatics.HTTP_REQUEST, req); -mock.setServletRequest((HttpServletRequest) req); +mock.setServletRequest(req); expectLastCall(); replay(mock); @@ -83,14 +80,14 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { } public void testServletResponseAware() throws Exception { -ServletResponseAware mock = (ServletResponseAware) createMock(ServletResponseAware.class); +ServletResponseAware mock = createMock(ServletResponseAware.class); MockHttpServletResponse res = new MockHttpServletResponse(); MockActionInvocation mai = createActionInvocation(mock); mai.getInvocationContext().put(StrutsStatics.HTTP_RESPONSE, res); -mock.setServletResponse((HttpServletResponse) res); +mock.setServletResponse(res); expectLastCall().times(1); replay(mock); @@ -120,7 +117,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { MockActionInvocation mai = createActionInvocation(mock); HttpParameters param = HttpParameters.create().build(); -mai.getInvocationContext().setParameters(param); +mai.getInvocationContext().withParameters(param); param.applyParameters(mock); expectLastCall().times(1); @@ -136,7 +133,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { MockActionInvocation mai = createActionInvocation(mock); HttpParameters param = HttpParameters.create().build(); -mai.getInvocationContext().setParameters(param); +mai.getInvocationContext().withParameters(param); mock.setParameters(param); expectLastCall().times(1); @@ -163,12 +160,12 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { } public void testSessionAware() throws Exception { -SessionAware mock = (SessionAware) createMock(SessionAware.class); +SessionAware mock = createMock(SessionAware.class); MockActionInvocation mai = createActionInvocation(mock); -Map session = new HashMap(); -mai.getInvocationContext().setSession(session); +Map session = new HashMap<>(); +mai.getInvocationContext().withSession(session); mock.setSession(session); expectLastCall().times(1); @@ -183,7 +180,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { MockActionInvocation mai = createActionInvocation(mock); -Map session = new HashMap(); +Map session = new HashMap<>(); mai.getInvocationContext().withSession(session); mock.withSession(session); @@ -199,7 +196,7 @@ public class ServletConfigInterceptorTest extends StrutsInternalTestCase { MockActionInvocation mai = createActionInvocation(mock); -Map app = new HashMap(); +Map app = new HashMap<>(); mai.getInvocationContext().withApplication(app); mock.setApplication(app); @@ -230,7 +227,7 @@ public class Servlet
(struts) branch revert-670-issue/WW-5251 updated (21af6e597 -> 2bba8ccd3)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch revert-670-issue/WW-5251 in repository https://gitbox.apache.org/repos/asf/struts.git discard 21af6e597 WW-5251 Fixes compilation errors in test new 2bba8ccd3 WW-5251 Fixes compilation errors in test This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (21af6e597) \ N -- N -- N refs/heads/revert-670-issue/WW-5251 (2bba8ccd3) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. 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. Summary of changes: .../struts2/portlet/interceptor/PortletStateInterceptorTest.java| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)