* Implement req.actionProcessor to allow onRequest() to set/override the function
called to handle the request. Required for continuation and callback support.
This commit is contained in:
parent
6063259455
commit
add89add1a
3 changed files with 45 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue