diff --git a/src/helma/framework/RequestBean.java b/src/helma/framework/RequestBean.java index 91d6cc23..c2688a98 100644 --- a/src/helma/framework/RequestBean.java +++ b/src/helma/framework/RequestBean.java @@ -202,4 +202,23 @@ public class RequestBean implements Serializable { return req.getUsername(); } + /** + * The action processor allows the onRequest() method to set the function object + * to be invoked for processing the request, overriding the action resolved + * from the request path. + * @return the action processor + */ + public Object getActionProcessor() { + return req.getActionProcessor(); + } + + /** + * The action processor allows the onRequest() method to set the function object + * to be invoked for processing the request, overriding the action resolved + * from the request path. + * @param processor the action processor + */ + public void setActionProcessor(Object processor) { + req.setActionProcessor(processor); + } } diff --git a/src/helma/framework/RequestTrans.java b/src/helma/framework/RequestTrans.java index ae8f7b03..34653e43 100644 --- a/src/helma/framework/RequestTrans.java +++ b/src/helma/framework/RequestTrans.java @@ -82,6 +82,7 @@ public class RequestTrans implements Serializable { // the name of the action being invoked private String action; + private Object actionProcessor = null; private String httpUsername; private String httpPassword; @@ -456,6 +457,26 @@ public class RequestTrans implements Serializable { this.action = suffix > -1 ? action.substring(0, suffix) : action; } + /** + * Get the request's action processor. The action processor allows the + * onRequest() method to set the function object to be invoked for processing + * the request, overriding the action resolved from the request path. + * @return the action processor + */ + public Object getActionProcessor() { + return actionProcessor; + } + + /** + * Set the request's action processor. The action processor allows the + * onRequest() method to set the function object to be invoked for processing + * the request, overriding the action resolved from the request path. + * @param processor the action processor + */ + public void setActionProcessor(Object processor) { + this.actionProcessor = processor; + } + /** * Get the time the request was created. */ diff --git a/src/helma/framework/core/RequestEvaluator.java b/src/helma/framework/core/RequestEvaluator.java index d9eeb391..783e6251 100644 --- a/src/helma/framework/core/RequestEvaluator.java +++ b/src/helma/framework/core/RequestEvaluator.java @@ -373,6 +373,9 @@ public final class RequestEvaluator implements Runnable { // reset skin recursion detection counter skinDepth = 0; + Object actionProcessor = req.getActionProcessor() != null ? + req.getActionProcessor() : action; + // do the actual action invocation if (req.isXmlRpc()) { XmlRpcRequestProcessor xreqproc = new XmlRpcRequestProcessor(); @@ -381,14 +384,14 @@ public final class RequestEvaluator implements Runnable { Vector args = xreq.getParameters(); args.add(0, xreq.getMethodName()); result = scriptingEngine.invoke(currentElement, - action, + actionProcessor, args.toArray(), ScriptingEngine.ARGS_WRAP_XMLRPC, false); res.writeXmlRpcResponse(result); } else { scriptingEngine.invoke(currentElement, - action, + actionProcessor, EMPTY_ARGS, ScriptingEngine.ARGS_WRAP_DEFAULT, false);