Merge remote-tracking branch 'origin/master' into fix/ftp-mount-errorhandling

Conflicts:
	plugins/c9.ide.mount/ftp.js
	plugins/c9.ide.mount/mount.js
pull/117/merge
Tim Robinson 2015-05-22 12:12:22 +00:00
commit 60234377c3
3 zmienionych plików z 30 dodań i 7 usunięć

23
node_modules/frontdoor/lib/section.js wygenerowano vendored
Wyświetl plik

@ -15,6 +15,7 @@ module.exports = function Section(name, description, types) {
var self = this; var self = this;
this.middlewares = []; this.middlewares = [];
this.globals = [];
this.errorHandlers = []; this.errorHandlers = [];
this.name = name; this.name = name;
@ -45,6 +46,18 @@ module.exports = function Section(name, description, types) {
}); });
}; };
/**
* Insert global middleware(s) for this section: The parent section is
* always an empty container that delegates to it's sub-sections, and
* executes all the middelwares for that section.
*
* This method allows us to inject a "global" middleware that is inserted
* *after* decodeParams and *before* all other middelwares.
*/
this.global = function( middleware ){
this.globals.push.apply(this.globals, flatten(middleware));
};
this.use = function(middleware) { this.use = function(middleware) {
this.middlewares.push.apply(this.middlewares, flatten(middleware)); this.middlewares.push.apply(this.middlewares, flatten(middleware));
}; };
@ -70,6 +83,13 @@ module.exports = function Section(name, description, types) {
return section; return section;
}; };
this.mount = function(name, section) {
if (!sections[name])
sections[name] = [];
sections[name].push(section);
};
this._rootHandler = function(req, res) { this._rootHandler = function(req, res) {
this.handle(req, res, function(err) { this.handle(req, res, function(err) {
if (err) { if (err) {
@ -118,6 +138,9 @@ module.exports = function Section(name, description, types) {
handler = handler.parent; handler = handler.parent;
} }
if (this.globals.length)
middleware.splice.apply( middleware, [1, 0].concat( this.globals ) );
var i = 0; var i = 0;
function processNext() { function processNext() {
handler = middleware[i++]; handler = middleware[i++];

Wyświetl plik

@ -67,7 +67,7 @@
"c9.ide.language.javascript.tern": "#7aab8b0b6a", "c9.ide.language.javascript.tern": "#7aab8b0b6a",
"c9.ide.language.javascript.infer": "#cfec494a3c", "c9.ide.language.javascript.infer": "#cfec494a3c",
"c9.ide.language.jsonalyzer": "#c253f093a0", "c9.ide.language.jsonalyzer": "#c253f093a0",
"c9.ide.collab": "#aeaa248d54", "c9.ide.collab": "#f0e96dd2cf",
"c9.ide.local": "#a9703b630c", "c9.ide.local": "#a9703b630c",
"c9.ide.find": "#6cc6d3379d", "c9.ide.find": "#6cc6d3379d",
"c9.ide.find.infiles": "#72582de3cd", "c9.ide.find.infiles": "#72582de3cd",
@ -91,8 +91,8 @@
"c9.ide.imgeditor": "#ed89162aa7", "c9.ide.imgeditor": "#ed89162aa7",
"c9.ide.immediate": "#6845a93705", "c9.ide.immediate": "#6845a93705",
"c9.ide.installer": "#3e6f7a72c9", "c9.ide.installer": "#3e6f7a72c9",
"c9.ide.mount": "#74f50c40a7", "c9.ide.mount": "#20339aeeaf",
"c9.ide.navigate": "#055a1f1a80", "c9.ide.navigate": "#f358997d93",
"c9.ide.newresource": "#f1f0624768", "c9.ide.newresource": "#f1f0624768",
"c9.ide.openfiles": "#28a4f5af16", "c9.ide.openfiles": "#28a4f5af16",
"c9.ide.preview": "#0bd8dd6e8c", "c9.ide.preview": "#0bd8dd6e8c",

Wyświetl plik

@ -22,7 +22,7 @@ define(function(require, exports, module) {
/***** Methods *****/ /***** Methods *****/
var REST_METHODS = ["get", "post", "put", "delete"]; var REST_METHODS = ["get", "post", "put", "delete", "patch"];
function wrapMethod(urlPrefix, method) { function wrapMethod(urlPrefix, method) {
return function(url, options, callback) { return function(url, options, callback) {
@ -33,7 +33,7 @@ define(function(require, exports, module) {
} }
var headers = options.headers = options.headers || {}; var headers = options.headers = options.headers || {};
headers.Accept = headers.Accept || "application/json"; headers.Accept = headers.Accept || "application/json";
options.method = method; options.method = method.toUpperCase();
if (!options.timeout) if (!options.timeout)
options.timeout = 60000; options.timeout = 60000;