Handle an incoming call request.
339969
def request(self, msgtype, msgid, method, params=[]):
        """"""
        result = None
        error = None
        exception = None

        try:
            result = self.dispatch.call(method, params)
        except Exception as e:
            error = (e.__class__.__name__, str(e))
            exception = e

        if isinstance(result, Deferred):
            result.add_callback(self._result, msgid)
            result.add_errback(self._error, msgid)
        else:
            self.send_response(msgid, error, result)
1201718
function callHandler(fn, req, res, next) {
    let context = new Context(req, res);
    if (utils.isGeneratorFunction(fn)) {
        co(fn).call(context, function (err) {
            if (err || !res.terminated) {
                next(err);
            }
        });
    } else {
        fn.call(context);
        if (!res.terminated) {
            next();
        }
    }
}
253053
def handle_notification(self, msgtype, method, args, kwargs):
        """"""
        self.dispatch.call(method, args, kwargs)
249881
def handle(self, msg):
        """"""
        debug_msg = ': {!r}'.format(msg) if self.debug else ''
        log.debug('request: %d bytes%s', len(msg), debug_msg)
        buf = io.BytesIO(msg)
        code, = util.recv(buf, '>B')
        if code not in self.methods:
            log.warning('Unsupported command: %s (%d)', msg_name(code), code)
            return failure()

        method = self.methods[code]
        log.debug('calling %s()', method.__name__)
        reply = method(buf=buf)
        debug_reply = ': {!r}'.format(reply) if self.debug else ''
        log.debug('reply: %d bytes%s', len(reply), debug_reply)
        return reply
493967
function call(handle) {
          handle.callback.apply(handle.context, args);
          called = true;
        }
763324
def _request_callback(self, request_id):
        """"""
        def callback(future):
            # Remove the future from the client requests map
            self._client_request_futures.pop(request_id, None)

            if future.cancelled():
                future.set_exception(JsonRpcRequestCancelled())

            message = {
                'jsonrpc': JSONRPC_VERSION,
                'id': request_id,
            }

            try:
                message['result'] = future.result()
            except JsonRpcException as e:
                log.exception("Failed to handle request %s", request_id)
                message['error'] = e.to_dict()
            except Exception:  # pylint: disable=broad-except
                log.exception("Failed to handle request %s", request_id)
                message['error'] = JsonRpcInternalError.of(sys.exc_info()).to_dict()

            self._consumer(message)

        return callback
899202
public void handleSuccess ()
    {
        if (_listener instanceof InvocationService.ConfirmListener) {
            reportRequestProcessed();
        } else if (_listener instanceof InvocationService.ResultListener && _resultSet) {
            reportRequestProcessed(_result);
        }
    }
239245
def handle_data(self, data):
        """"""
        if 'id' in data:
            self.handle_response(data)
        else:
            self.handle_notification(data)
1004060
def handleRequest(self, req):
        """"""
        name = req["method"]
        params = req["params"]
        id=req["id"]
        obj=None
        try: #to get a callable obj 
            obj = getMethodByName(self.service, name)
        except MethodNameNotAllowed,e:
            self.sendResponse(id, None, e)
        except:
            self.sendResponse(id, None, MethodNotFound())
        if obj:
            try: #to call the object with parameters
                rslt = obj(*params)
                self.sendResponse(id, rslt, None)
            except TypeError: # wrong arguments
                #todo what if the TypeError was not thrown directly by the callable obj
                s=getTracebackStr()
                self.sendResponse(id, None, InvalidMethodParameters())
            except: #error inside the callable object
                s=getTracebackStr()
                self.sendResponse(id, None, s)
1102874
def dispatch(self):
        """"""
        method_name = 'on_' + self.environ['REQUEST_METHOD'].lower()
        method = getattr(self, method_name, None)
        if method:
            return method()
        else:
            return self.on_bad_method()
831050
function dispatch(request, response) {
    return Promise.resolve()
      .then(resolveRouters.bind(this, request))
      .then(callAction.bind(this, request, response));
  }
218210
def handle(self):
        ''''''
        try:
            yield self
        except:
            # Requeue the message and raise the original exception
            typ, value, trace = sys.exc_info()
            if not self.processed:
                try:
                    self.req(self.delay())
                except socket.error:
                    self.connection.close()
            raise typ, value, trace
        else:
            if not self.processed:
                try:
                    self.fin()
                except socket.error:
                    self.connection.close()
620630
function serviceCall(req, res, next) {
        Q(pushService.registerPushDevice(req.body)).then(res.json.bind(res), next).done();
    }
220318
def _fetch(self, request):
        
        client = self.client

        #: Dispatch the async call
        call = Call(__id__=client.newCall(request.request))
        call.enqueue(request.handler)

        #: Save the call reference
        request.call = call
456349
function serviceCall(req, res, next) {
        Q(pushService.fetchPushNotification(req.params.uuid)).then(res.json.bind(res), next).done();
    }
726429
function tryCall(handler, data, callback)
{
  try {
    handler(data, callback);
  } catch (e) {
    callback(e);
  }
}
789899
def handle_request(self, request, **resources):
        
        if not request.method in self._meta.callmap.keys():
            raise HttpError(
                'Unknown or unsupported method \'%s\'' % request.method,
                status=status.HTTP_501_NOT_IMPLEMENTED)

        # Get the appropriate create/read/update/delete function
        view = getattr(self, self._meta.callmap[request.method])

        # Get function data
        return view(request, **resources)