本文整理汇总了Java中com.opensymphony.xwork.ActionProxy类的典型用法代码示例。如果您正苦于以下问题:Java ActionProxy类的具体用法?Java ActionProxy怎么用?Java ActionProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionProxy类属于com.opensymphony.xwork包,在下文中一共展示了ActionProxy类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAction
import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
/**
* Get an action from the webwork configuration. The action returned will also execute
* the interceptors associated with the action
* @param namespace Namespace to find the action in
* @param actionName Name of action to run (e.g. 'show_tissue_taxonomy')
* @param params Map of parameters to fill the action with
* @return Proxy of action to execute
* @throws Exception
*/
protected ActionProxy getAction(String namespace, String actionName, Map<String,Object> params) throws Exception
{
HashMap<String, Map<String, Object>> extraContext = new HashMap<String, Map<String, Object>>();
extraContext.put(ActionContext.PARAMETERS, params);
ActionProxy actionProxy = null;
actionProxy = actionFactory.createActionProxy(namespace, actionName, extraContext);
// Only execute the action, but don't render a result
actionProxy.setExecuteResult(false);
ActionContext context = actionProxy.getInvocation().getInvocationContext();
context.setSession(new HashMap<String,Object>());
return actionProxy;
}
示例2: getKey
import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
private String getKey(ActionInvocation invocation) {
ActionProxy proxy = invocation.getProxy();
if (key == null || "CLASS".equals(key)) {
return "webwork.ScopeInterceptor:" + proxy.getAction().getClass();
} else if ("ACTION".equals(key)) {
return "webwork.ScopeInterceptor:" + proxy.getNamespace() + ":" + proxy.getActionName();
}
return key;
}
示例3: invokeAction
import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
protected ActionInvocation invokeAction(DispatcherUtils du, HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionDefinition actionDefinition, Map params) throws ServletException
{
ActionMapping mapping = getActionMapping(actionDefinition, params);
Map extraContext = du.createContextMap(request, response, mapping, context);
// If there was a previous value stack, then create a new copy and pass it in to be used by the new Action
OgnlValueStack stack = (OgnlValueStack) request.getAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY);
if (null != stack)
{
extraContext.put(ActionContext.VALUE_STACK, new OgnlValueStack(stack));
}
try
{
prepareContinuationAction(request, extraContext);
ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(actionDefinition.getNamespace(), actionDefinition.getAction(), extraContext, actionDefinition.isExecuteResult(), false);
proxy.setMethod(actionDefinition.getMethod());
request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, proxy.getInvocation().getStack());
// if the ActionMapping says to go straight to a result, do it!
if (mapping.getResult() != null)
{
Result result = mapping.getResult();
result.execute(proxy.getInvocation());
}
else
{
proxy.execute();
}
return proxy.getInvocation();
}
catch (ConfigurationException ce)
{
throw new ServletException("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", ce);
}
catch (Exception e)
{
throw new ServletException("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", e);
}
finally
{
// If there was a previous value stack then set it back onto the request
if (null != stack)
{
request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, stack);
}
}
}
示例4: invokeAction
import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
/**
*
*/
@SuppressWarnings("unchecked")
protected ActionInvocation invokeAction(DispatcherUtils du, HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionDefinition actionDefinition, Map<String, String> params) throws ServletException
{
ActionMapping mapping = getActionMapping(actionDefinition, params);
Map<String, Object> extraContext = du.createContextMap(request, response, mapping, context);
// If there was a previous value stack, then create a new copy and pass it in to be used by the new Action
OgnlValueStack stack = (OgnlValueStack) request.getAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY);
if (null != stack)
{
extraContext.put(ActionContext.VALUE_STACK, new OgnlValueStack(stack));
}
try
{
prepareContinuationAction(request, extraContext);
ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy(actionDefinition.getNamespace(), actionDefinition.getAction(), extraContext, actionDefinition.isExecuteResult(), false);
proxy.setMethod(actionDefinition.getMethod());
request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, proxy.getInvocation().getStack());
// if the ActionMapping says to go straight to a result, do it!
if (mapping.getResult() != null)
{
Result result = mapping.getResult();
result.execute(proxy.getInvocation());
}
else
{
proxy.execute();
}
return proxy.getInvocation();
}
catch (ConfigurationException ce)
{
throw new ServletException("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", ce);
}
catch (Exception e)
{
throw new ServletException("Cannot invoke action '" + actionDefinition.getAction() + "' in namespace '" + actionDefinition.getNamespace() + "'", e);
}
finally
{
// If there was a previous value stack then set it back onto the request
if (null != stack)
{
request.setAttribute(ServletActionContext.WEBWORK_VALUESTACK_KEY, stack);
}
}
}
示例5: setContributor
import com.opensymphony.xwork.ActionProxy; //导入依赖的package包/类
protected void setContributor(ActionProxy proxy, int contributorId) {
ActionContext context = proxy.getInvocation().getInvocationContext();
context.getSession().put("contributor_id",contributorId);
}