This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var {defer} = require("ringo/promise"); | |
var {setTimeout} = require("ringo/scheduler"); | |
exports.delayed = function(request) { | |
var response = defer(); | |
setTimeout(function() { | |
response.resolve({ | |
status: 200, headers: {}, body: ["Delayed"] | |
}); | |
}, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.ringojs.wrappers; | |
import org.mozilla.javascript.Context; | |
import org.mozilla.javascript.Function; | |
import org.mozilla.javascript.Scriptable; | |
import org.mozilla.javascript.ScriptableObject; | |
import org.mozilla.javascript.annotations.JSFunction; | |
import org.mozilla.javascript.annotations.JSStaticFunction; | |
// Note: there's nothing special about this host class (except for the missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function outer(x) { | |
var y; | |
for (var i = 0; i < 10000000; i++) { | |
y = inner(); | |
} | |
function inner() { | |
return x; | |
} | |
return inner(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/auth.js b/auth.js | |
index 0ae0627..b324f8e 100644 | |
--- a/auth.js | |
+++ b/auth.js | |
@@ -6,11 +6,11 @@ module.shared = true; | |
exports.middleware = function (app) { | |
return function (env) { | |
- if (auth[env.PATH_INFO.replace(/^\//, '').replace(/\/$/, '')]) { | |
+ if (auth[env.pathInfo.replace(/^\//, '').replace(/\/$/, '')]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
to get websocket protocol running in ringojs, do the following: | |
* copy jetty-websocket-7.*.jar into your classpath (e.g. lib/) | |
* add the following line to your webapp's config.js module: | |
exports.extensions = ["ringo-websocket"]; | |
with "ringo-websocket" being the module name of this file. | |
* download the client script from this page: | |
http://blogs.webtide.com/gregw/entry/jetty_websocket_server | |
change the location to: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var {Response, skinResponse} = require('ringo/webapp/response'); | |
var {ContinuationSession} = require('ringo/webapp/continuation'); | |
var log = require('ringo/logging').getLogger(module.id); | |
// the main action is invoked for http://localhost:8080/ | |
exports.index = { | |
GET: function(req) { | |
return skinResponse('./skins/welcome.txt', {title: 'Demo'}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var {Response, skinResponse} = require('ringo/webapp/response'); | |
var {ContinuationSession} = require('ringo/webapp/continuation'); | |
var log = require('ringo/logging').getLogger(module.id); | |
// the main action is invoked for http://localhost:8080/ | |
exports.index = function(req) { | |
return skinResponse('./skins/welcome.txt', {title: 'Demo'}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: cometd-java/server/src/main/java/org/cometd/server/AbstractBayeux.java | |
=================================================================== | |
--- cometd-java/server/src/main/java/org/cometd/server/AbstractBayeux.java (Revision 1264) | |
+++ cometd-java/server/src/main/java/org/cometd/server/AbstractBayeux.java (Arbeitskopie) | |
@@ -1348,10 +1348,8 @@ | |
return; | |
} | |
- if (_securityPolicy.canPublish(client,channel_id,message)) | |
- { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var {request} = require("ringo/httpclient"); | |
var urls = [ | |
"http://www.henso.com/", | |
"http://www.ringojs.org/wiki/", | |
"http://github.com/" | |
]; | |
var responses = urls.map(function(url) { | |
return request({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream.prototype.forEach = function(callback) { | |
var length = 8192; | |
var buffer = new ByteArray(length); | |
while (true) { | |
var read = this.readInto(buffer, 0, length); | |
if (read < 0) | |
break; | |
buffer.length = read; | |
callback(buffer); | |
buffer.length = length; |