Added skinDepth counter to allow skins to detect recursive skin invocation.

This commit is contained in:
hns 2002-09-23 15:21:36 +00:00
parent 4839b658b5
commit 107dbbea7e

View file

@ -58,6 +58,7 @@ public final class RequestEvaluator implements Runnable {
static final int XMLRPC = 2; // via XML-RPC static final int XMLRPC = 2; // via XML-RPC
static final int INTERNAL = 3; // generic function call, e.g. by scheduler static final int INTERNAL = 3; // generic function call, e.g. by scheduler
public int skinDepth;
/** /**
* Create a new RequestEvaluator for this application. * Create a new RequestEvaluator for this application.
@ -230,6 +231,9 @@ public final class RequestEvaluator implements Runnable {
// set the req.action property, cutting off the _action suffix // set the req.action property, cutting off the _action suffix
req.action = action.substring (0, action.length()-7); req.action = action.substring (0, action.length()-7);
// reset skin recursion detection counter
skinDepth = 0;
// try calling onRequest() function on object before // try calling onRequest() function on object before
// calling the actual action // calling the actual action
try { try {
@ -240,6 +244,9 @@ public final class RequestEvaluator implements Runnable {
// function is not defined or caused an exception, ignore // function is not defined or caused an exception, ignore
} }
// reset skin recursion detection counter
skinDepth = 0;
// do the actual action invocation // do the actual action invocation
scriptingEngine.invoke (currentElement, action, new Object[0], false); scriptingEngine.invoke (currentElement, action, new Object[0], false);
@ -346,6 +353,8 @@ public final class RequestEvaluator implements Runnable {
// check XML-RPC access permissions // check XML-RPC access permissions
String proto = app.getPrototypeName (currentElement); String proto = app.getPrototypeName (currentElement);
app.checkXmlRpcAccess (proto, method); app.checkXmlRpcAccess (proto, method);
// reset skin recursion detection counter
skinDepth = 0;
result = scriptingEngine.invoke (currentElement, method, args, true); result = scriptingEngine.invoke (currentElement, method, args, true);
commitTransaction (); commitTransaction ();
@ -396,6 +405,8 @@ public final class RequestEvaluator implements Runnable {
globals.put ("app", app); globals.put ("app", app);
scriptingEngine.enterContext (globals); scriptingEngine.enterContext (globals);
// reset skin recursion detection counter
skinDepth = 0;
result = scriptingEngine.invoke (thisObject, method, args, false); result = scriptingEngine.invoke (thisObject, method, args, false);
commitTransaction (); commitTransaction ();