/** * Initializes the options for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KObjectConfig $config Configuration options. * @return void */ protected function _initialize(KObjectConfig $config) { $config->append(array('controller' => 'com:scheduler.controller.dispatcher', 'response' => 'com:koowa.dispatcher.response', 'request' => 'com:koowa.dispatcher.request', 'user' => 'com:koowa.user')); parent::_initialize($config); }
/** * Send the response to the client * * - Set the affected entities in the payload for none-SAFE requests that return a successful response. Make an * exception for 204 No Content responses which should not return a response body. * * - Add an Allow header to the response if the status code is 405 METHOD NOT ALLOWED. * * {@inheritdoc} */ protected function _actionSend(KDispatcherContextInterface $context) { $request = $this->getRequest(); $response = $this->getResponse(); if (!$request->isSafe()) { if ($response->isSuccess()) { //Render the controller and set the result in the response body if ($response->getStatusCode() !== KHttpResponse::NO_CONTENT) { $context->result = $this->getController()->execute('render', $context); } } else { //Add an Allow header to the response if ($response->getStatusCode() === KHttpResponse::METHOD_NOT_ALLOWED) { try { $this->_actionOptions($context); } catch (Exception $e) { } } } } parent::_actionSend($context); }