r9682 - in helma-ng/trunk/modules/helma: . webapp
[email protected] Tue, 28 Apr 2009 11:01:07 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090428090107.8B8783D0D6@mia> |
Author: hannes
Date: 2009-04-28 11:01:07 +0200 (Tue, 28 Apr 2009)
New Revision: 9682
Modified:
helma-ng/trunk/modules/helma/webapp.js
helma-ng/trunk/modules/helma/webapp/request.js
Log:
Add pathDecoded property to request object with the URL-decoded request path, and use it where appropriate.
Details at http://dev.helma.org/trac/helma/changeset/9682
Modified: helma-ng/trunk/modules/helma/webapp/request.js
===================================================================
--- helma-ng/trunk/modules/helma/webapp/request.js 2009-04-28 09:01:04 UTC (rev 9681)
+++ helma-ng/trunk/modules/helma/webapp/request.js 2009-04-28 09:01:07 UTC (rev 9682)
@@ -17,6 +17,10 @@
define("path", readOnlyPropertyDesc(servletRequest, "requestURI"));
define("method", readOnlyPropertyDesc(servletRequest, "method"));
+ define("pathDecoded", {
+ get: function() { return decodeURI(this.path) }
+ });
+
define("params", {
get: function() {
if (!params)
Modified: helma-ng/trunk/modules/helma/webapp.js
===================================================================
--- helma-ng/trunk/modules/helma/webapp.js 2009-04-28 09:01:04 UTC (rev 9681)
+++ helma-ng/trunk/modules/helma/webapp.js 2009-04-28 09:01:07 UTC (rev 9682)
@@ -95,8 +95,8 @@
// log.debug("got action: " + action);
if (typeof action == "function" && pathArray.length <= action.length) {
// add remaining path elements as additional action arguments
- var actionArgs = pathArray.slice(1).map(decodeURIComponent);
- var matchedArgs = match.slice(1).map(decodeURIComponent);
+ var actionArgs = pathArray.slice(1);
+ var matchedArgs = match.slice(1);
var args = [req].concat(matchedArgs).concat(actionArgs);
var middleware = config.middleware;
var middlewareIndex = 0;
@@ -121,7 +121,7 @@
}
try {
- res = resolveInConfig(config, path, "");
+ res = resolveInConfig(config, decodeURI(path), "");
} catch (e) {
if (e.retry) {
throw e;
@@ -197,7 +197,7 @@
res.status = 404;
res.contentType = 'text/html';
res.writeln('<h1>Not Found</h1>');
- res.writeln('The requested URL', req.path, 'was not found on the server.');
+ res.writeln('The requested URL', req.pathDecoded, 'was not found on the server.');
return res.close();
}