r9769 - helma-ng/trunk/modules/helma/webapp
[email protected] Thu, 14 May 2009 20:47:31 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090514184731.246EF3D0D6@mia> |
Author: hannes
Date: 2009-05-14 20:47:31 +0200 (Thu, 14 May 2009)
New Revision: 9769
Modified:
helma-ng/trunk/modules/helma/webapp/continuation.js
Log:
use shorter ids and check they're not used already.
Details at http://dev.helma.org/trac/helma/changeset/9769
Modified: helma-ng/trunk/modules/helma/webapp/continuation.js
===================================================================
--- helma-ng/trunk/modules/helma/webapp/continuation.js 2009-05-14 18:28:25 UTC (rev 9768)
+++ helma-ng/trunk/modules/helma/webapp/continuation.js 2009-05-14 18:47:31 UTC (rev 9769)
@@ -2,12 +2,13 @@
* Continuation support for Helma NG
*/
-export('ContinuationSession');
-
+require('core/string');
var system = require('helma/system');
var log = require('helma/logging').getLogger(__name__);
importClass(java.util.HashMap);
+export('ContinuationSession');
+
function ContinuationSession(req, id, step) {
step = parseInt(step) || 0;
@@ -81,7 +82,11 @@
}
function generateId() {
- return Math.ceil(Math.random() * Math.pow(2, 32)).toString(36);
+ var id;
+ do {
+ id = String.random(5);
+ } while (getData(req, id))
+ return id;
}
}