Processes the client-side payload, and transforms the client-side
callback function signal to an actual callback function
9163
function getPayload(req, res, next) {
  req.hasCallback = false;
  req.payload = req.body.payload || [];

  // Determines if the request is asynchronous or not
  req.payload.forEach(function(arg, i) {
    if (arg === '__clientCallback__') {
      req.hasCallback = true;
      req.clientCallbackIndex = i;
    }
  });

  debug('Got payload' + (req.hasCallback ? ' with callback' : '') + ': ' +
    JSON.stringify(req.payload, null, 3));

  next();
}
428147
def process(self):
        """"""
        try:
            self.receiver(self)
        # TODO RESTException
        except Exception as e:
            current_app.logger.exception('Could not process event.')
            self.response_code = 500
            self.response = dict(status=500, message=str(e))
        return self
713224
public static function manipulate(Payload $payload, $callback)
    {
        self::assert_callable($callback);

        $payload->replaceData($callback($payload->extractTypeData()));

        return $payload;
    }
1315841
function processCallback(err, buf, encoding, done) {
		// When doing sync writes + emitting an errror it can happen that
		// Remove the error listener on the next tick if an error where fired
		// to avoid unwanted error throwing
		if (err) {
			setImmediate(function () {
				_this.removeListener('error', _state.errorHandler);
			});
		} else {
			_this.removeListener('error', _state.errorHandler);
		}

		_state.sent = true;

		cb(err, buf, encoding, function (err, buf, encoding) {
			if (err) {
				setImmediate(function () {
					_this.emit('error', err);
				});
				return;
			}

			if (!buf) {
				done();
				return;
			}

			_state.manager.programPush(buf, encoding, done);
		});
	}
1111553
def _receive_callback(self, raw_message):
        """"""
        message = self.backend.message_to_python(raw_message)
        if self.auto_ack and not message.acknowledged:
            message.ack()
        try:
            decoded = message.decode()
        except Exception, exc:
            if not self.on_decode_error:
                raise
            self.on_decode_error(message, exc)
        else:
            self.receive(decoded, message)
105538
def handler(self):
		''
		from feedjack import filters # shouldn't be imported globally, as they may depend on models
		proc_func = getattr(filters, self.handler_name or self.name, None)
		if proc_func is None:
			if '.' not in self.handler_name:
				raise ImportError('Processing function not available: {0}'.format(self.handler_name))
			proc_module, proc_func = it.imap(str, self.handler_name.rsplit('.', 1))
			proc_func = getattr(__import__(proc_module, fromlist=[proc_func]), proc_func)
		return proc_func
1307226
function handler(req, res) {

        var path = cog.getConfig('options.api_data');
        var urlRegex = cog.getConfig('options.api_url_regex');
        var url = req.url.replace(/^\//, '').replace(/\/$/, '');

        console.log(req.method + ' ' + req.url);

        // Find the JSON-data file and serve it, if URL points to the API.
        if (path && urlRegex && urlRegex.test(url)) {
            var file = path + '/' + url + '.json';
            if (grunt.file.exists(file)) {
                res.end(grunt.file.read(file));
                return;
            }
        }

        if (req.method == 'POST') {
            // TODO: This needs fixing, since it throws an error.
            res.end('{"message": "OK"}');
        }

    }
551278
def set_server_callback(self, handle):
        
        if self.on_events:
            for event in self.on_events:
                handle.on_event(event, self.on_event)
        if self.on_changes:
            for change in self.on_changes:
                if change in ['patching', 'streaming']:
                    # Patch and stream events do not need handling on server
                    continue
                handle.on_change(change, self.on_change)
191384
def ProcessMessage(self, message):
    """"""
    self.ProcessResponse(message.source.Basename(), message.payload)
27471
def pipe_to_process(self, payload):
        """"""
        message = payload['input']
        key = payload['key']
        if not self.process_handler.is_running(key):
            return {'message': 'No running process for this key',
                    'status': 'error'}
        self.process_handler.send_to_process(message, key)
        return {'message': 'Message sent',
                'status': 'success'}
1120029
function(callback) {
        var headers     = this._formatHeaders(this.headers, this.params);
        if (this.payload != null) {
            headers['content-length'] = new Buffer(this.payload).length;
        } else if (this.method == 'POST' || this.method == 'DELETE' || this.method == 'PUT') {
            headers['content-length'] = 0;
        }
        var client = this.httpClient.http;
        if (this.scheme == 'https') client = this.httpClient.https;
        var httpRequest = client.request({port    : this.port,
                                          host    : this.host,
                                          method  : this.method,
                                          path    : this.uri,
                                          headers : headers},
                                         function(response) {
                                             var data = "";
                                             response.on('data', function(chunk) {
                                                 data += chunk;
                                             });
                                             response.on('end', function() {
                                                 var c = {
                                                     status  : response.statusCode,
                                                     headers : response.headers,
                                                     body    : data
                                                 };
                                                 callback(null, c);
                                             });
                                         });
        httpRequest.on('error', function(e) {
            callback(e, null);
        });
        if (this.payload !== null)
            httpRequest.write(this.payload);
        httpRequest.end();
    }
81607
def processResponse(self, arg, replytype, **kw):
        
        if self.debug:
            log.msg('--->PROCESS REQUEST\n%s' %arg, debug=1)

        for h in self.handlers:
            arg.addCallback(h.processResponse, **kw)
            
        arg.addCallback(self.parseResponse, replytype)
69153
function (response_type, event) {
	
		LOG.sys('handling event response [' + response_type  + ']', l_name);
		
		// go over each registered callback function and see which one responds
		for (var i=0; i < l_responders[response_type].length; i++) {
			// find the callback with matching client id
			// call callback and see whether it has been processed
			if (l_responders[response_type][i].cid === event.cid) {
				// log incoming message type & IP/port
				LOG.sys(SR.Tags.RCV + response_type + ' from ' + event.printSource() + SR.Tags.END, l_name);

				// make callback
				UTIL.safeCall(l_responders[response_type][i].onResponse, event);

				// then remove it
				l_responders[response_type].splice(i, 1);
				i--;
			}
		}
	}
198940
public function processRequest()
    {
        $this->signal->send($this, 'onProcessRequest');

        if (Console::isCli()) {
            $exitCode = $this->_runner->run($_SERVER['argv']);
            if (is_int($exitCode)) {
                $this->end($exitCode);
            }
        } else {
            $this->runController($this->parseRoute());
        }
    }
136730
function()
			{
				var func = todo.shift();
				if (!func)
				{
					// all done!
					if (callback) callback(false);
					return;
				}

				if (token_fetch.indexOf(func.func) >= 0)
				{
					// if we're actually calling a token fetch function, skip!
					process.nextTick(step);
				}
				else
				{
					func.func(function(error) {
						if (error)
						{
							// token fetching error!
							if (callback) callback(func.name + " :: " + error);
							return;
						}

						// do next step
						process.nextTick(step);
					});
				}
			}
1111053
function _transform() {
	var codeIn = $('#codeIn').val();
	try {
		var codeOut = Streamline.transform(codeIn, {
			runtime: _generators ? "generators" : "callbacks",
		});
		$('#codeOut').val(codeOut);
		info("ready");
	} catch (ex) {
		console.error(ex);
		error(ex.message);
	}
}
901532
function processRequest()
    {
        /* tis' the job of the index page, not of the class!
        global $HTTP_SERVER_VARS;
        if ( $HTTP_SERVER_VARS["REQUEST_METHOD"] != "POST" )
        {
            print( "Error: this web page does only understand POST methods" );
            exit();
        }
        */

        $namespaceURI = 'unknown_namespace_uri';

        /// @todo dechunk, correct encoding, check for supported
        /// http features of the client, etc...
        $data = $this->RawPostData;

        $data = $this->inflateRequest( $data );
        if ( $data === false )
        {
            $this->showResponse(
                'unknown_function_name',
                $namespaceURI,
                new ggWebservicesFault( self::INVALIDCOMPRESSIONERROR, self::INVALIDCOMPRESSIONSTRING ) );
        }

        $request = $this->parseRequest( $data );

        if ( !is_object( $request ) ) /// @todo use is_a instead
        {
            $this->showResponse(
                'unknown_function_name',
                $namespaceURI,
                new ggWebservicesFault( self::INVALIDREQUESTERROR, self::INVALIDREQUESTSTRING ) );
        }
        else
        {
            $functionName = $request->name();
            $params = $request->parameters();
            if ( $this->isInternalRequest( $functionName ) )
            {
                $response = $this->handleInternalRequest( $functionName, $params );
            }
            else
            {
                $response = $this->handleRequest( $functionName, $params );
            }
            $this->showResponse( $functionName, $namespaceURI, $response );
        }
    }