[struts] 01/01: WW-4789 WW-3788 ActionContext refactoring
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch action-context-boost in repository https://gitbox.apache.org/repos/asf/struts.git commit 6721c9c98ae2eaf926f20901998990c4add798f2 Author: Lukasz Lenart AuthorDate: Sat Mar 21 10:05:48 2020 +0100 WW-4789 WW-3788 ActionContext refactoring --- .../com/opensymphony/xwork2/ActionContext.java | 46 +- .../opensymphony/xwork2/ognl/OgnlValueStack.java | 5 + .../interceptor/ActionAutowiringInterceptor.java | 5 +- .../com/opensymphony/xwork2/util/ValueStack.java | 44 +++--- .../org/apache/struts2/ServletActionContext.java | 38 +++-- .../java/org/apache/struts2/StrutsStatics.java | 38 +++-- .../apache/struts2/components/ActionComponent.java | 8 +- .../struts2/components/ServletUrlRenderer.java | 2 +- .../template/FreemarkerTemplateEngine.java | 8 +- .../org/apache/struts2/dispatcher/Dispatcher.java | 155 - .../apache/struts2/dispatcher/InitOperations.java | 4 +- .../dispatcher/listener/StrutsListener.java| 1 - .../dispatcher/mapper/DefaultActionMapper.java | 2 +- .../ActionMappingParametersInterceptor.java| 2 +- .../interceptor/CookieProviderInterceptor.java | 2 +- .../interceptor/CreateSessionInterceptor.java | 9 +- .../struts2/interceptor/FileUploadInterceptor.java | 2 +- .../interceptor/MessageStoreInterceptor.java | 2 +- .../interceptor/ServletConfigInterceptor.java | 16 +-- .../interceptor/TokenSessionStoreInterceptor.java | 6 +- .../debugging/DebuggingInterceptor.java| 6 +- .../main/java/org/apache/struts2/util/URLBean.java | 3 +- .../struts2/views/freemarker/FreemarkerResult.java | 2 +- .../com/opensymphony/xwork2/StubValueStack.java| 5 + .../apache/struts2/ServletActionContextTest.java | 10 +- .../interceptor/CreateSessionInterceptorTest.java | 13 +- .../struts2/interceptor/I18nInterceptorTest.java | 2 +- .../main/java/org/apache/struts2/JSPLoader.java| 6 +- .../sitemesh/FreemarkerDecoratorServlet.java | 2 +- .../struts2/sitemesh/VelocityDecoratorServlet.java | 2 +- 30 files changed, 270 insertions(+), 176 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ActionContext.java b/core/src/main/java/com/opensymphony/xwork2/ActionContext.java index 757dffd..595c7c6 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ActionContext.java +++ b/core/src/main/java/com/opensymphony/xwork2/ActionContext.java @@ -22,8 +22,14 @@ import com.opensymphony.xwork2.conversion.impl.ConversionData; import com.opensymphony.xwork2.inject.Container; import com.opensymphony.xwork2.util.ValueStack; import org.apache.struts2.StrutsException; +import org.apache.struts2.StrutsStatics; import org.apache.struts2.dispatcher.HttpParameters; +import org.apache.struts2.dispatcher.mapper.ActionMapping; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.PageContext; import java.io.Serializable; import java.util.HashMap; import java.util.Locale; @@ -106,12 +112,18 @@ public class ActionContext implements Serializable { * Creates a new ActionContext initialized with another context. * * @param context a context map. + * + * @deprecated Please use {@link #of(Map)} builder method */ +@Deprecated public ActionContext(Map context) { this.context = context; } - +public static ActionContext of(Map context) { +ActionContext.setContext(new ActionContext(context)); +return ActionContext.getContext(); +} /** * Sets the action invocation (the execution state). * @@ -347,4 +359,36 @@ public class ActionContext implements Serializable { public void put(String key, Object value) { context.put(key, value); } + +public ServletContext getServletContext() { +return (ServletContext) get(StrutsStatics.SERVLET_CONTEXT); +} + +public HttpServletRequest getServletRequest() { +return (HttpServletRequest) get(StrutsStatics.HTTP_REQUEST); +} + +public HttpServletResponse getServletResponse() { +return (HttpServletResponse) get(StrutsStatics.HTTP_RESPONSE); +} + +public void setServletContext(ServletContext servletContext) { +put(StrutsStatics.SERVLET_CONTEXT, servletContext); +} + +public ActionMapping getActionMapping() { +return (ActionMapping) get(StrutsStatics.ACTION_MAPPING); +} + +public PageContext getPageContext() { +return (PageContext) get(StrutsStatics.PAGE_CONTEXT); +} + +public void setServletRequest(HttpServletRequest request) { +put(StrutsStatics.HTTP_REQUEST, request); +} + +public void setServletResponse(HttpServletResponse response) { +put(StrutsStatics.HTTP_RESPON
[struts] branch action-context-boost created (now 6721c9c)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch action-context-boost in repository https://gitbox.apache.org/repos/asf/struts.git. at 6721c9c WW-4789 WW-3788 ActionContext refactoring This branch includes the following new commits: new 6721c9c WW-4789 WW-3788 ActionContext refactoring 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 action-context-boost updated (6721c9c -> 8eb936c)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch action-context-boost in repository https://gitbox.apache.org/repos/asf/struts.git. discard 6721c9c WW-4789 WW-3788 ActionContext refactoring new 8eb936c WW-4789 WW-3788 ActionContext refactoring 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 (6721c9c) \ N -- N -- N refs/heads/action-context-boost (8eb936c) 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: .../com/opensymphony/xwork2/ActionContext.java | 103 +++--- .../opensymphony/xwork2/DefaultActionProxy.java| 4 +- .../xwork2/config/impl/DefaultConfiguration.java | 5 +- .../xwork2/util/XWorkTestCaseHelper.java | 7 +- .../org/apache/struts2/ServletActionContext.java | 2 +- .../org/apache/struts2/dispatcher/Dispatcher.java | 3 +- .../apache/struts2/dispatcher/InitOperations.java | 3 +- .../struts2/dispatcher/PrepareOperations.java | 11 +- .../struts2/dispatcher/mapper/ActionMapping.java | 2 +- .../apache/struts2/factory/StrutsActionProxy.java | 4 +- .../struts2/interceptor/BackgroundProcess.java | 4 +- .../struts2/util/InvocationSessionStore.java | 6 +- .../apache/struts2/util/StrutsTestCaseHelper.java | 4 +- .../org/apache/struts2/views/jsp/TagUtils.java | 6 +- .../com/opensymphony/xwork2/ActionContextTest.java | 10 +- .../xwork2/ActionContextThreadLocalTest.java | 25 +-- .../com/opensymphony/xwork2/ActionSupportTest.java | 6 +- .../com/opensymphony/xwork2/ChainResultTest.java | 10 +- .../xwork2/DefaultTextProviderTest.java| 6 +- .../com/opensymphony/xwork2/LocaleAwareTest.java | 4 +- .../opensymphony/xwork2/WildCardResultTest.java| 6 +- .../impl/AnnotationXWorkConverterTest.java | 3 +- .../conversion/impl/XWorkBasicConverterTest.java | 2 +- .../DefaultWorkflowInterceptorTest.java| 23 +-- .../interceptor/ValidationErrorAwareTest.java | 20 +- ...ationInterceptorPrefixMethodInvocationTest.java | 97 + .../ActionAutowiringInterceptorTest.java | 17 +- .../DefaultActionValidatorManagerTest.java | 4 +- .../validator/SimpleActionValidationTest.java | 7 +- .../validator/VisitorFieldValidatorModelTest.java | 2 +- .../validator/VisitorFieldValidatorTest.java | 2 +- .../struts2/dispatcher/PrepareOperationsTest.java | 2 +- .../dispatcher/TwoFilterIntegrationTest.java | 21 +- .../interceptor/ExecuteAndWaitInterceptorTest.java | 4 +- .../struts2/interceptor/I18nInterceptorTest.java | 23 +-- .../struts2/interceptor/TokenInterceptorTest.java | 5 +- .../struts2/result/HttpHeaderResultTest.java | 2 +- .../struts2/util/InvocationSessionStoreTest.java | 25 ++- .../org/apache/struts2/util/TokenHelperTest.java | 67 +++--- .../struts2/views/freemarker/FreemarkerTest.java | 2 +- .../apache/struts2/views/jsp/AbstractTagTest.java | 22 +- .../struts2/views/jsp/AbstractUITagTest.java | 2 +- .../org/apache/struts2/views/jsp/TextTagTest.java | 15 +- .../org/apache/struts2/views/jsp/URLTagTest.java | 29 ++- .../PackageBasedActionConfigBuilderTest.java | 3 +- .../org/apache/struts2/EmbeddedJSPResultTest.java | 52 +++-- .../struts2/views/java/simple/AbstractTest.java| 50 ++--- .../struts2/views/java/simple/TokenTest.java | 5 +- .../apache/struts2/json/JSONInterceptorTest.java | 7 +- .../org/apache/struts2/StrutsJUnit4TestCase.java | 2 +- .../org/apache/struts2/StrutsRestTestCase.java | 48 ++--- .../java/org/apache/struts2/StrutsTestCase.java| 2 +- .../struts2/osgi/OsgiConfigurationProvider.java| 9 +- .../struts2/components/PortletUrlRenderer.java | 2 +- .../portlet/dispatcher/Jsr168Dispatcher.java | 4 +- .../portlet/dispatcher/Jsr286Dispatcher.java | 4 +- .../portlet/context/PortletActionContextTest.java | 6 +- .../struts2/portlet/result/PortletResultTest.java | 82 .../struts2/portlet/util/PortletUrlHelperTest.java | 148 +++--- .../struts2/views/jsp/PortletUrlTagTest.java | 227 ++
[struts] branch action-context-boost updated (8eb936c -> 1f45859)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch action-context-boost in repository https://gitbox.apache.org/repos/asf/struts.git. discard 8eb936c WW-4789 WW-3788 ActionContext refactoring new 1f45859 WW-4789 WW-3788 ActionContext refactoring 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 (8eb936c) \ N -- N -- N refs/heads/action-context-boost (1f45859) 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: .../com/opensymphony/xwork2/ActionChainResult.java | 8 .../com/opensymphony/xwork2/ChainResultTest.java | 20 +--- 2 files changed, 17 insertions(+), 11 deletions(-)
[struts] branch action-context-boost updated (1f45859 -> e4a39eb)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch action-context-boost in repository https://gitbox.apache.org/repos/asf/struts.git. discard 1f45859 WW-4789 WW-3788 ActionContext refactoring new e4a39eb WW-4789 WW-3788 ActionContext refactoring 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 (1f45859) \ N -- N -- N refs/heads/action-context-boost (e4a39eb) 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: .../main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java | 1 - core/src/main/resources/struts-default.xml | 1 - 2 files changed, 2 deletions(-)