/** * Process the request * * Basically this method will parse the URL and search for a component that can * handle the request. If one is found, it will process the request, if not, it * will report an error, depending on the situation. * * Details: The logic will traverse the node tree and for each node it will load * the component that is responsible for it. This component gets the chance to * accept the request (this is encapsulated in the _can_handle call), which is * basically a call to can_handle. If the component declares to be able to handle * the call, its handle function is executed. Depending if the handle was successful * or not, it will either display an HTTP error page or prepares the content handler * to display the content later on. * * If the parsing process doesn't find any component that declares to be able to * handle the request, an HTTP 404 - Not Found error is triggered. */ private function _process(midcom_core_context $context) { $resolver = new midcom_core_resolver($context); $handler = $resolver->process(); if (false === $handler) { /** * Simple: if current context is not '0' we were called from another context. * If so we should not break application now - just gracefully continue. */ if ($context->id == 0) { // We couldn't fetch a node due to access restrictions if (midcom_connection::get_error() == MGD_ERR_ACCESS_DENIED) { throw new midcom_error_forbidden(midcom::get('i18n')->get_string('access denied', 'midcom')); } else { throw new midcom_error_notfound("This page is not available on this server."); } } $this->_status = MIDCOM_STATUS_ABORT; return false; } $context->run($handler); if ($context->id == 0 && $this->skip_page_style == true) { $this->_status = MIDCOM_STATUS_CONTENT; // Enter Context $oldcontext = $context; midcom_core_context::get(0)->set_current(); midcom::get('style')->enter_context(0); $this->_output(); // Leave Context midcom::get('style')->leave_context(); $oldcontext->set_current(); $this->finish(); _midcom_stop_request(); } else { $this->_status = MIDCOM_STATUS_CONTENT; } }