Uses the new versions of methods without ServletContext

This commit is contained in:
Lukasz Lenart
2014-02-17 09:33:38 +01:00
parent a2e97a9ca4
commit 4a4d04164a
2 changed files with 28 additions and 36 deletions
@@ -21,17 +21,15 @@
package org.apache.struts2.components;
import java.io.IOException;
import java.io.Writer;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ActionProxyFactory;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsException;
import org.apache.struts2.StrutsStatics;
@@ -43,15 +41,14 @@ import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.jsp.TagUtils;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ActionProxyFactory;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import java.io.IOException;
import java.io.Writer;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* <!-- START SNIPPET: javadoc -->
@@ -188,7 +185,6 @@ public class ActionComponent extends ContextBean {
Map newParams = createParametersForContext();
ActionContext ctx = new ActionContext(stack.getContext());
ServletContext servletContext = (ServletContext) ctx.get(ServletActionContext.SERVLET_CONTEXT);
PageContext pageContext = (PageContext) ctx.get(ServletActionContext.PAGE_CONTEXT);
Map session = ctx.getSession();
Map application = ctx.getApplication();
@@ -199,8 +195,7 @@ public class ActionComponent extends ContextBean {
session,
application,
req,
res,
servletContext);
res);
ValueStack newStack = valueStackFactory.createValueStack(stack);
extraContext.put(ActionContext.VALUE_STACK, newStack);
@@ -21,12 +21,11 @@
package org.apache.struts2.views.jsp;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import org.apache.struts2.RequestUtils;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.ApplicationMap;
@@ -37,11 +36,10 @@ import org.apache.struts2.dispatcher.mapper.ActionMapper;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.util.AttributeMap;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import java.util.Map;
/**
@@ -67,8 +65,7 @@ public class TagUtils {
new SessionMap(req),
new ApplicationMap(pageContext.getServletContext()),
req,
res,
pageContext.getServletContext());
res);
extraContext.put(ServletActionContext.PAGE_CONTEXT, pageContext);
stack.getContext().putAll(extraContext);
req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);