use of com.opensymphony.xwork2.ActionProxyFactory in project onebusaway-application-modules by camsys.
the class MultiActionProxyFactory method setActionMappers.
@Inject(MAPPINGS)
public void setActionMappers(String list) {
if (list != null) {
String[] tokens = list.split(",");
for (String token : tokens) {
String[] kvp = token.split("=");
String key = kvp[0];
String name = kvp[1];
ActionProxyFactory factory = container.getInstance(ActionProxyFactory.class, name);
if (factory != null) {
_prefixedActionProxyFactories.add(new Prefixed<ActionProxyFactory>(key, factory));
} else {
throw new IllegalStateException("unknown ActionProxyFactory " + name);
}
}
}
}
use of com.opensymphony.xwork2.ActionProxyFactory in project entando-core by entando.
the class ApsAdminBaseTestCase method initAction.
/**
* Created action class based on namespace and name
*
* @param namespace The namespace
* @param name The name of the action
* @throws java.lang.Exception In case of error
*/
protected void initAction(String namespace, String name) throws Exception {
// create a proxy class which is just a wrapper around the action call.
// The proxy is created by checking the namespace and name against the
// struts.xml configuration
ActionProxyFactory proxyFactory = (ActionProxyFactory) this._dispatcher.getContainer().getInstance(ActionProxyFactory.class);
this._proxy = proxyFactory.createActionProxy(namespace, name, null, null, true, false);
// set to true if you want to process Freemarker or JSP results
this._proxy.setExecuteResult(false);
// by default, don't pass in any request parameters
// set the actions context to the one which the proxy is using
ServletActionContext.setContext(_proxy.getInvocation().getInvocationContext());
ServletActionContext.setRequest(_request);
ServletActionContext.setResponse(_response);
ServletActionContext.setServletContext(_servletContext);
this._action = (ActionSupport) this._proxy.getAction();
// reset previsious params
List<String> paramNames = new ArrayList<String>(this._request.getParameterMap().keySet());
for (int i = 0; i < paramNames.size(); i++) {
String paramName = (String) paramNames.get(i);
this.removeParameter(paramName);
}
}
Aggregations