/**
  * Dispatch the node
  * @param zibo\core\Request $request
  * @param zibo\core\Response $response
  * @return array Array with the region name as key and a view array as value. The view array has the widget id as key and the dispatched widget view as value
  */
 public function dispatch(Request $request, Response $response)
 {
     $cache = Module::getCache();
     if (!$this->breadcrumbs) {
         $this->breadcrumbs = new Breadcrumbs();
     }
     $parameters = str_replace(Request::QUERY_SEPARATOR, '-', $request->getParametersAsString());
     $views = array();
     foreach ($this->regions as $regionName => $widgets) {
         foreach ($widgets as $widgetId => $widget) {
             $isJoppaWidget = $widget instanceof JoppaWidget;
             $cacheKey = $this->node->id . '#' . $regionName . '#' . $widgetId . '#' . $this->node->dataLocale . '#' . $parameters;
             if ($isJoppaWidget) {
                 if (!$_POST) {
                     $view = $cache->get(Module::CACHE_TYPE_NODE_WIDGET_VIEW, $cacheKey);
                     if ($view) {
                         $views[$regionName][$widgetId] = $view;
                         continue;
                     }
                 }
                 $widget->setBreadcrumbs($this->breadcrumbs);
                 $widget->setNode($this->node);
             }
             $this->dispatchWidget($request, $response, $widgetId, $widget);
             if ($response->willRedirect()) {
                 return;
             }
             $view = $response->getView();
             $response->setView(null);
             if ($view instanceof FileView) {
                 return $view;
             }
             if ($isJoppaWidget && $widget->isContent()) {
                 if ($request->isXmlHttpRequest()) {
                     return $view;
                 }
                 $views[$regionName] = array($widgetId => $view);
                 break;
             }
             if ($isJoppaWidget && $widget->isCacheable()) {
                 $cache->set(Module::CACHE_TYPE_NODE_WIDGET_VIEW, $cacheKey, $view);
             }
             $views[$regionName][$widgetId] = $view;
         }
     }
     return $views;
 }