Handles the output from downstream requests
@param  object $req
@param  string $appStatus
@param  string $protoStatus
@return void
511095
public function endRequest($req, $appStatus, $protoStatus)
    {
        $c = pack('NC', $appStatus, $protoStatus) // app status, protocol status
            . "\x00\x00\x00";

        $this->write(
            "\x01" // protocol version
            . "\x03" // record type (END_REQUEST)
            . pack('nn', $req->attrs->id, mb_orig_strlen($c)) // id, content length
            . "\x00" // padding length
            . "\x00" // reserved
            . $c // content
        );

        if ($protoStatus === -1) {
            $this->close();
        } elseif (!$this->pool->config->keepalive->value) {
            $this->finish();
        }
    }
1015153
public function output()
    {
        header('Content-type: application/json');
        $data = array(
            'status' => $this->status,
            'data' => $this->data
        );
        echo json_encode($data);
        die();
    }
268602
public function sendBadRequestStatus() {
    $Config = GiroCheckout_SDK_Config::getInstance();

    if ($Config->getConfig('DEBUG_MODE')) {
      GiroCheckout_SDK_Debug_helper::getInstance()->logNotificationOutput('sendBadRequestStatus');
    }

    header('HTTP/1.1 400 Bad Request');
  }
1079885
public function execute()
    {
        if (defined('PSI_PLUGIN_PSSTATUS_PROCESSES') && is_string(PSI_PLUGIN_PSSTATUS_PROCESSES)) {
            if (preg_match(ARRAY_EXP, PSI_PLUGIN_PSSTATUS_PROCESSES)) {
                $processes = eval(PSI_PLUGIN_PSSTATUS_PROCESSES);
            } else {
                $processes = array(PSI_PLUGIN_PSSTATUS_PROCESSES);
            }
            if ((PSI_OS == 'WINNT') && (strtolower(PSI_PLUGIN_PSSTATUS_ACCESS) == 'command')) {
                foreach ($processes as $process) {
                    $this->_result[] = array($process, $this->process_inarray(strtolower($process), $this->_filecontent));
                }
            } else {
                foreach ($processes as $process) {
                    $this->_result[] = array($process, $this->process_inarray($process, $this->_filecontent));
                }
            }
        }
    }
1235092
function () {
        if (req.status !== 200) {
          console.warn(req.responseText);
          return;
        }
        // Show the raw response text on page
        xmlOutput.textContent = req.responseText;
        // convert XML to javascript objects
        var json = sdmxmllib.mapSDMXMLResponse(req.responseText);
        // Convert to json and show on page
        jsonOutput.textContent = JSON.stringify(json, null, 2);
    }
60472
public function updateResponse(ApplicationInterface $application, RequestInterface $request, ResponseInterface $response): void
    {
        $response->setStatusCode($this->statusCode);
        $response->setContent($this->content);
    }
707072
private function processSystemTask($systemKey, array $systemTask, OutputInterface $output)
    {
        if (!$systemTask['enabled']) {
            if ($this->disableSystemTask($systemKey)) {
                $output->writeln(sprintf(' * System-task "%s" was <comment>disabled</comment>', $systemKey));
            }

            return;
        }

        if ($task = $this->taskRepository->findBySystemKey($systemKey)) {
            $this->updateTask($systemKey, $systemTask, $task);

            $output->writeln(sprintf(' * System-task "%s" was <info>updated</info>', $systemKey));

            return;
        }

        /** @var TaskBuilder $builder */
        $builder = $this->scheduler->createTask($systemTask['handler_class'], $systemTask['workload']);
        $builder->setSystemKey($systemKey);
        if ($systemTask['cron_expression']) {
            $builder->cron($systemTask['cron_expression']);
        }

        $builder->schedule();

        $output->writeln(sprintf(' * System-task "%s" was <info>created</info>', $systemKey));
    }
785636
function execute(req, res) {
  var t = systime();
  res.send(null, [t.s, t.m]);
}
784084
private void processStreamUpload(final UploadStream req) {
    assert (req.body() == null);
    try {
      RpcResponseCallback callback = new RpcResponseCallback() {
        @Override
        public void onSuccess(ByteBuffer response) {
          respond(new RpcResponse(req.requestId, new NioManagedBuffer(response)));
        }

        @Override
        public void onFailure(Throwable e) {
          respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
        }
      };
      TransportFrameDecoder frameDecoder = (TransportFrameDecoder)
          channel.pipeline().get(TransportFrameDecoder.HANDLER_NAME);
      ByteBuffer meta = req.meta.nioByteBuffer();
      StreamCallbackWithID streamHandler = rpcHandler.receiveStream(reverseClient, meta, callback);
      if (streamHandler == null) {
        throw new NullPointerException("rpcHandler returned a null streamHandler");
      }
      StreamCallbackWithID wrappedCallback = new StreamCallbackWithID() {
        @Override
        public void onData(String streamId, ByteBuffer buf) throws IOException {
          streamHandler.onData(streamId, buf);
        }

        @Override
        public void onComplete(String streamId) throws IOException {
           try {
             streamHandler.onComplete(streamId);
             callback.onSuccess(ByteBuffer.allocate(0));
           } catch (Exception ex) {
             IOException ioExc = new IOException("Failure post-processing complete stream;" +
               " failing this rpc and leaving channel active", ex);
             callback.onFailure(ioExc);
             streamHandler.onFailure(streamId, ioExc);
           }
        }

        @Override
        public void onFailure(String streamId, Throwable cause) throws IOException {
          callback.onFailure(new IOException("Destination failed while reading stream", cause));
          streamHandler.onFailure(streamId, cause);
        }

        @Override
        public String getID() {
          return streamHandler.getID();
        }
      };
      if (req.bodyByteCount > 0) {
        StreamInterceptor<RequestMessage> interceptor = new StreamInterceptor<>(
          this, wrappedCallback.getID(), req.bodyByteCount, wrappedCallback);
        frameDecoder.setInterceptor(interceptor);
      } else {
        wrappedCallback.onComplete(wrappedCallback.getID());
      }
    } catch (Exception e) {
      logger.error("Error while invoking RpcHandler#receive() on RPC id " + req.requestId, e);
      respond(new RpcFailure(req.requestId, Throwables.getStackTraceAsString(e)));
      // We choose to totally fail the channel, rather than trying to recover as we do in other
      // cases.  We don't know how many bytes of the stream the client has already sent for the
      // stream, it's not worth trying to recover.
      channel.pipeline().fireExceptionCaught(e);
    } finally {
      req.meta.release();
    }
  }
1005912
public function process( array $reqparams, $content )
	{
		if( isset( $reqparams['jsonrpc'] ) || !isset( $reqparams['method'] ) ) {
			return $this->processStream( $content );
		}

		return $this->processRequest( $reqparams );
	}
1131572
def status(to, show, status="")
      httpost('/statuses', reqdata().merge({
        :nick => @endpoint[:nick],
        :to => to,
        :show => show,
        :status => status
      }))
    end
980308
public function putStatus($appId, $id, $action, $assignee = null, $guestSpaceId = null, $revision = -1): array
    {
        $options = ['json' => [
            'app' => $appId,
            'id' => $id,
            'action' => $action,
            'revision' => $revision
        ]];
        if ($assignee !== null) {
            $options['json']['assignee'] = $assignee;
        }

        /** @var JsonStream $stream */
        $stream = $this->client
            ->put(KintoneApi::generateUrl('record/status.json', $guestSpaceId), $options)
            ->getBody();

        return $stream->jsonSerialize();
    }
980059
function _preServiceCall({ node, type, preStatus, callerId, shouldDumpStoreOnActionCall }, payload) {
    //There is a problem if the node is empty. //Node should be an array
    let data = {};
    let status = {};
    const STATUS = { name: preStatus, isLoading: true };
    type = shouldDumpStoreOnActionCall ? 'update' : 'updateStatus';
    // When there is a multi node update it should be an array.
    if (Array.isArray(node)) {
        node.forEach((nd) => {
            data[nd] = shouldDumpStoreOnActionCall ? null : (payload && payload[nd]) || null;
            status[nd] = STATUS;
        });
    } else {
        data[node] = shouldDumpStoreOnActionCall ? null : (payload || null);
        status[node] = STATUS;
    }
    //Dispatch store cleaning.
    dispatcher.handleViewAction({ data, type, status, callerId });
}
207011
void processStatus(final HttpServerExchange exchange, final RequestData requestData) throws IOException {

        final String jvmRoute = requestData.getFirst(JVMROUTE);
        final String loadValue = requestData.getFirst(LOAD);

        if (loadValue == null || jvmRoute == null) {
            processError(TYPESYNTAX, SMISFLD, exchange);
            return;
        }

        UndertowLogger.ROOT_LOGGER.receivedNodeLoad(jvmRoute, loadValue);
        final int load = Integer.parseInt(loadValue);
        if (load > 0 || load == -2) {

            final Node node = container.getNode(jvmRoute);
            if (node == null) {
                processError(MCMPErrorCode.CANT_READ_NODE, exchange);
                return;
            }

            final NodePingUtil.PingCallback callback = new NodePingUtil.PingCallback() {
                @Override
                public void completed() {
                    final String response = "Type=STATUS-RSP&State=OK&JVMRoute=" + jvmRoute + "&id=" + creationTime;
                    try {
                        if (load > 0) {
                            node.updateLoad(load);
                        }
                        sendResponse(exchange, response);
                    } catch (Exception e) {
                        UndertowLogger.ROOT_LOGGER.failedToSendPingResponse(e);
                    }
                }

                @Override
                public void failed() {
                    final String response = "Type=STATUS-RSP&State=NOTOK&JVMRoute=" + jvmRoute + "&id=" + creationTime;
                    try {
                        node.markInError();
                        sendResponse(exchange, response);
                    } catch (Exception e) {
                        UndertowLogger.ROOT_LOGGER.failedToSendPingResponseDBG(e, node.getJvmRoute(), jvmRoute);
                    }
                }
            };

            // Ping the node
            node.ping(exchange, callback);

        } else if (load == 0) {
            final Node node = container.getNode(jvmRoute);
            if (node != null) {
                node.hotStandby();
                sendResponse(exchange, "Type=STATUS-RSP&State=OK&JVMRoute=" + jvmRoute + "&id=" + creationTime);
            } else {
                processError(MCMPErrorCode.CANT_READ_NODE, exchange);
            }
        } else if (load == -1) {
            // Error, disable node
            final Node node = container.getNode(jvmRoute);
            if (node != null) {
                node.markInError();
                sendResponse(exchange, "Type=STATUS-RSP&State=NOTOK&JVMRoute=" + jvmRoute + "&id=" + creationTime);
            } else {
                processError(MCMPErrorCode.CANT_READ_NODE, exchange);
            }
        } else {
            processError(TYPESYNTAX, SMISFLD, exchange);
        }
    }
696663
public function endRequest($req, $appStatus, $protoStatus)
    {
        if ($protoStatus === -1) {
            $this->close();
        } else {
            if ($req->attrs->chunked) {
                $this->write("0\r\n\r\n");
            }

            if (isset($req->keepalive) && $req->keepalive && $this->pool->config->keepalive->value) {
                $this->keepaliveTimer = setTimeout(function ($timer) {
                    $this->finish();
                }, $this->pool->config->keepalive->value);
            } else {
                $this->finish();
            }
        }
        $this->freeRequest($req);
    }
1119322
public function req($reqStatus, array $configs, $defaultId = false)
    {
        $key = array_search($reqStatus, $this->coll->column($configs, 'name', 'id'));
        if ($key === false) {
            $key = $defaultId;
        }

        if ($key === false) {
            $config = current($configs);
        } else {
            $config = $configs[$key];
        }

        return $config['name'];
    }
1085153
function execute(req, res) {
  var proxy = req.exec ? req.exec.proxy : this.proxy;
  res.send(null, proxy(req, res));
}