Add request path elements to the macro handler dictionary in the response object.
Plus a few minor additional cleanups.
This commit is contained in:
parent
3a6cffaf83
commit
2faba077fa
1 changed files with 11 additions and 4 deletions
|
@ -150,13 +150,15 @@ public final class RequestEvaluator implements Runnable {
|
||||||
res.message = session.message;
|
res.message = session.message;
|
||||||
session.message = null;
|
session.message = null;
|
||||||
}
|
}
|
||||||
|
Map macroHandlers = res.getMacroHandlers ();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
// there was an error in the previous loop, call error handler
|
// there was an error in the previous loop, call error handler
|
||||||
currentElement = root;
|
currentElement = root;
|
||||||
requestPath.add (currentElement);
|
// do not reset the requestPath so error handler can use the original one
|
||||||
|
// get error handler action
|
||||||
String errorAction = app.props.getProperty ("error", "error");
|
String errorAction = app.props.getProperty ("error", "error");
|
||||||
action = getAction (currentElement, errorAction);
|
action = getAction (currentElement, errorAction);
|
||||||
if (action == null)
|
if (action == null)
|
||||||
|
@ -165,6 +167,7 @@ public final class RequestEvaluator implements Runnable {
|
||||||
} else if (req.path == null || "".equals (req.path.trim ())) {
|
} else if (req.path == null || "".equals (req.path.trim ())) {
|
||||||
currentElement = root;
|
currentElement = root;
|
||||||
requestPath.add (currentElement);
|
requestPath.add (currentElement);
|
||||||
|
macroHandlers.put ("root", root);
|
||||||
action = getAction (currentElement, null);
|
action = getAction (currentElement, null);
|
||||||
if (action == null)
|
if (action == null)
|
||||||
throw new FrameworkException ("Action not found");
|
throw new FrameworkException ("Action not found");
|
||||||
|
@ -183,12 +186,16 @@ public final class RequestEvaluator implements Runnable {
|
||||||
|
|
||||||
currentElement = root;
|
currentElement = root;
|
||||||
requestPath.add (currentElement);
|
requestPath.add (currentElement);
|
||||||
|
macroHandlers.put ("root", root);
|
||||||
|
|
||||||
for (int i=0; i<ntokens; i++) {
|
for (int i=0; i<ntokens; i++) {
|
||||||
|
|
||||||
if (currentElement == null)
|
if (currentElement == null)
|
||||||
throw new FrameworkException ("Object not found.");
|
throw new FrameworkException ("Object not found.");
|
||||||
|
|
||||||
|
if (pathItems[i].length () == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
// we used to do special processing for /user and /users
|
// we used to do special processing for /user and /users
|
||||||
// here but with the framework cleanup, this stuff has to be
|
// here but with the framework cleanup, this stuff has to be
|
||||||
// mounted manually.
|
// mounted manually.
|
||||||
|
@ -201,15 +208,15 @@ public final class RequestEvaluator implements Runnable {
|
||||||
|
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
|
|
||||||
if (pathItems[i].length () == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
currentElement = app.getChildElement (currentElement, pathItems[i]);
|
currentElement = app.getChildElement (currentElement, pathItems[i]);
|
||||||
|
|
||||||
// add object to request path if suitable
|
// add object to request path if suitable
|
||||||
if (currentElement != null) {
|
if (currentElement != null) {
|
||||||
// add to requestPath array
|
// add to requestPath array
|
||||||
requestPath.add (currentElement);
|
requestPath.add (currentElement);
|
||||||
|
String protoName = app.getPrototypeName (currentElement);
|
||||||
|
if (protoName != null)
|
||||||
|
macroHandlers.put (protoName, currentElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue