"onRequest" listener.

@param Request  $req
@param Response $res
437483
public function onRequest($req, $res)
    {
        $this->app->event->trigger('swoole.request');

        $this->resetOnRequest();

        /** @var Sandbox $sandbox */
        $sandbox = $this->app->make(Sandbox::class);
        $request = $this->prepareRequest($req);

        try {
            $sandbox->setRequest($request);

            $sandbox->init();

            $response = $sandbox->run($request);

            $this->sendResponse($sandbox, $response, $res);
        } catch (Throwable $e) {
            try {
                $exceptionResponse = $this->app
                    ->make(Handle::class)
                    ->render($request, $e);

                $this->sendResponse($sandbox, $exceptionResponse, $res);
            } catch (Throwable $e) {
                $this->logServerError($e);
            }
        } finally {
            $sandbox->clear();
        }
    }
171237
function on_connect(res){
	//console.log('STATUS: ' + res.statusCode);
	//console.log('HEADERS: ' + JSON.stringify(res.headers));
	res.setEncoding('utf8');
	var raw_data = '';
	res.on('data', function (chunk) {
	    //console.log('BODY: ' + chunk);
	    raw_data = raw_data + chunk;
	});
	// Throw to .
	res.on('end', function () {
	    //console.log('END with: ' + raw_data);
	    var response = new anchor._response_handler(raw_data);
	    if( response && response.okay() ){
		anchor.apply_callbacks('success', [response, anchor]);
	    }else{
		// Make sure that there is something there to
		// hold on to.
		if( ! response ){
		    response = new anchor._response_handler(null);
		    response.okay(false);
		    response.message_type('error');
		    response.message('null response');
		}else{
		    response.message_type('error');
		    response.message('bad response');
		}
		anchor.apply_callbacks('error', [response, anchor]);
	    }
	});
    }
615268
function handler(req, res) {

  var parsedUrl = url.parse(req.url)
  var callback = qs.parse(parsedUrl.query).callback
  var filename = decodeURI(parsedUrl.path.substr(1).split('?')[0])
  var basename = path.basename(filename.split('?')[0])
  var extname = path.extname(basename)
  var response = reswrap(res);
  var notfound = function() {
    response.writeHead(404, 'text').end('');
  };

  if (req.method === 'GET' && parsedUrl.pathname === '/jsonp-request') {
    if (!!exitCountdown) {
      exitCountdown.restart();
    }

    response
      .writeHead(200, 'js')
      .end(callback +'('+ R.get('stamp') +')');

    return;
  }

  var serve;
  if (/^\/template/.test(parsedUrl.pathname)) {
    serve = check(join(__dirname, '..', filename))
  } else if (/^\/node_modules/.test(parsedUrl.pathname)) {
    serve = check(join(__dirname, '..', filename))
  }
  if (serve) {
    serve.pass(function(name, type) {
      response
        .writeHead(200, extname.substr(1))
        .pipeWith(fs.createReadStream(
          path.resolve(name)
        ))
    }).fail(notfound);
    return;
  }

  if (/^\.(md|mkd|markdown|html)$/.test(extname)) {
    check(filename)
      .pass(function() {
        response
          .writeHead(200, 'html')
          .end(template.render({
            title: basename,
            highlight: R.get('highlight') || 'default',
            theme: getTheme(R.get('css')),
            width: R.get('width'),
            body: parser.parse(read(path.resolve(filename)))
          }));
      }).fail(notfound);

    return;
  }

  // Image or some other resources.
  check(filename)
    .pass(function(name) {
      response
        .writeHead(200, name)
        .pipeWith(fs.createReadStream(name));
    }).fail(notfound)
}
783830
public function onKernelEarlyRequest(GetResponseEvent $e)
    {
        $request = $e->getRequest();

        foreach ($this->pathConfig as $regex => $config) {
            if (preg_match($regex, $request->getPathInfo())) {
                $this->enabled = true;

                if (!$this->subscribed) {
                    $e->getDispatcher()->addSubscriber($this);
                    $this->subscribed = true;
                }

                //set other relevant values for this request
                $config['suppress_response_codes'] = ($config['allow_code_suppression']) ? $request->query->get('_suppress_codes', false) : false;
                $config['http_response_format'] = $request->get('_format', false);
                $config['negotiated'] = false;

                //subsequent listeners will check the request attributes for relevant configuration
                $request->attributes->set('_ac_web_service', $config);

                return;
            }
        }

        $this->enabled = false;
    }
543658
def on_post(self, req, resp, **kwargs):
        """"""
        validated = self.require_validated(req)

        return super().on_post(
            req, resp,
            handler=partial(self._create, validated=validated),
            **kwargs
        )
116406
function () {

            var res = arguments[0];

            userOptions.emit('response', req, res);

            if (callback && userOptions.resCallback) callback.apply(this, arguments);

            res.on('end', function() {
                userOptions.emit('afterResponse', req, res);
            });

        }
452426
public function sendNotify($req)
    {
        if (property_exists($req, 'id') && $req->id != null) {
            throw new Clientside\Exception("Notify requests must not have ID set");
        }

        $this->send($req->getJSON(), true);
        return true;
    }
61694
public function negotiateRequestFormat(Request $req)
    {
        $header = $req->headers->get('Content-Type');

        $exp = explode(';', $header);
        $type = $exp[0];

        return isset($this->inputFormatMap[$type]) ? $this->inputFormatMap[$type] : false;
    }
1205881
public function onKernelRequest(GetResponseEvent $event)
    {
        if (!in_array($event->getRequest()->attributes->get('_route'), $this->allowedRoutes, true)) {
            return;
        }

        $this->requestListener->onKernelRequest($event);
    }
1026006
@Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    if (req.getRequestURI().endsWith("upload")) {
      uploadCallback(req, resp);
    } else {
      resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
    }
  }
636712
function(req, res, route) {
    req.on('data', function(data) {
      req.body = queryStringToJSON(data.toString());
      route.callback(req, res);
    });
  }
717980
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        WebAppServletInvocationEvent evt = null;
        if (notifyInvocationListeners) {
            evt = new WebAppServletInvocationEvent(this, getServletContext(), getServletName(), servletConfig.getClassName(), req, res); // 263020
        }

        service(req, res, evt);
    }
1085851
private function destroyRememberMeCookie(Request $req, Response $res)
    {
        $cookie = $this->getRememberMeCookie($req);
        if ($cookie) {
            $cookie->destroy();
        }

        $sessionCookie = session_get_cookie_params();
        $res->setCookie($this->rememberMeCookieName(),
            '',
            time() - 86400,
            $sessionCookie['path'],
            $sessionCookie['domain'],
            $sessionCookie['secure'],
            true);

        return $this;
    }
709346
public function requestOut($req, $s)
    {
        if ($this->write($s) === false) {
            $req->abort();
            return false;
        }
        return true;
    }
1343968
private synchronized void pushRequestContext(ServletContext context,
                                                 ServletRequest req,
                                                 ServletResponse resp)
    {
        getRequestStack().push(new RequestContext(context, req, resp));
    }
611494
def on_get(self, req, resp, **kwargs):
        """"""
        return super().on_get(req, resp, handler=self._list, **kwargs)
200175
function onSubmit(vRequest) {
			if (Array.isArray(vRequest)) {
				vRequest.forEach(onSubmit);
			} else if (vRequest.$submit) {
				vRequest.$submit();
			}
		}