public function renderView($viewVariables, $template)
    {
        $encoder = $this->handler->getEncoder();
        if (method_exists($encoder, 'renderView')) {
            return $encoder->renderView(
                $template,
                array_merge($this->viewContext, (array)$viewVariables)
            );
        } else {
            throw new Exception('The current encoder does not support the render view method.');
        }
    }