1
2
3 package org.apache.struts2.impl;
4
5 import java.util.Map;
6 import java.util.concurrent.Callable;
7
8 import com.opensymphony.xwork2.ActionContext;
9 import com.opensymphony.xwork2.DefaultActionProxy;
10 import com.opensymphony.xwork2.config.Configuration;
11
12 public class StrutsActionProxy extends DefaultActionProxy {
13
14 private static final long serialVersionUID = -2434901249671934080L;
15
16 public StrutsActionProxy(Configuration cfg, String namespace, String actionName, Map extraContext,
17 boolean executeResult, boolean cleanupContext) throws Exception {
18 super(cfg, namespace, actionName, extraContext, executeResult, cleanupContext);
19 }
20
21 public String execute() throws Exception {
22 ActionContext previous = ActionContext.getContext();
23 ActionContext.setContext(invocation.getInvocationContext());
24 try {
25 return RequestContextImpl.callInContext(invocation, new Callable<String>() {
26 public String call() throws Exception {
27 return invocation.invoke();
28 }
29 });
30 } finally {
31 if (cleanupContext)
32 ActionContext.setContext(previous);
33 }
34 }
35 }