AppserverIo\Appserver\PersistenceContainer\PersistenceContainerValve::invoke PHP Метод

invoke() публичный Метод

Processes the request by invoking the request handler that executes the servlet in a protected context.
public invoke ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The response instance
Результат void
    public function invoke(HttpServletRequestInterface $servletRequest, HttpServletResponseInterface $servletResponse)
    {
        try {
            // unpack the remote method call
            $remoteMethod = RemoteMethodProtocol::unpack($servletRequest->getBodyContent());
            // load the application context
            /** @var \AppserverIo\Appserver\Application\Application $application */
            $application = $servletRequest->getContext();
            // invoke the remote method and re-attach the bean instance to the container
            $response = $application->search(BeanContextInterface::IDENTIFIER)->invoke($remoteMethod, new ArrayList());
            // serialize the remote method and write it to the socket
            $servletResponse->appendBodyStream(RemoteMethodProtocol::pack($response));
        } catch (\Exception $e) {
            // catch the exception and append it to the body stream
            $servletResponse->appendBodyStream(RemoteMethodProtocol::pack(RemoteExceptionWrapper::factory($e)));
        }
        // finally dispatch this request, because we have finished processing it
        $servletRequest->setDispatched(true);
    }
PersistenceContainerValve