/**
  * @param string $content
  * @param \AgaviRequestDataHolder|array $parameters
  * @param \AgaviValidationManager $validationManager
  * @param array $config
  * @return string
  */
 protected function executeFormPopulationFilter($content, $parameters, $validationManager = null, array $config = array())
 {
     $container = $this->_context->getController()->createExecutionContainer('FilterTests', 'FormPopulationFilter');
     $container->getResponse()->setContent($content);
     if ($parameters instanceof AgaviRequestDataHolder) {
         $rd = $parameters;
     } else {
         $rd = new AgaviRequestDataHolder(array(AgaviRequestDataHolder::SOURCE_PARAMETERS => $parameters));
     }
     if ($validationManager) {
         $validationManager->execute($rd);
     }
     $fpf = new AgaviFormPopulationFilter();
     $fpf->initialize($this->_context, array_merge(array('populate' => $rd, 'validation_report' => $validationManager ? $validationManager->getReport() : null, 'force_request_uri' => '/'), $config));
     $filterChain = new AgaviFilterChain();
     $filterChain->initialize($this->_context);
     $fpf->execute($filterChain, $container);
     return $container->getResponse()->getContent();
 }
 /**
  * Pretty-print this exception using a template.
  *
  * @param      Exception     The original exception.
  * @param      AgaviContext  The context instance.
  * @param      AgaviResponse The response instance.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      1.0.0
  */
 public static function render(Exception $e, AgaviContext $context = null, AgaviExecutionContainer $container = null)
 {
     // exit code is 70, EX_SOFTWARE, according to /usr/include/sysexits.h: http://cvs.opensolaris.org/source/xref/on/usr/src/head/sysexits.h
     // nice touch: an exception template can change this value :)
     $exitCode = 70;
     $exceptions = array();
     if (version_compare(PHP_VERSION, '5.3', 'ge')) {
         // reverse order of exceptions
         $ce = $e;
         while ($ce) {
             array_unshift($exceptions, $ce);
             $ce = $ce->getPrevious();
         }
     } else {
         $exceptions[] = $e;
     }
     if ($container !== null && $container->getOutputType() !== null && $container->getOutputType()->getExceptionTemplate() !== null) {
         // an exception template was defined for the container's output type
         include $container->getOutputType()->getExceptionTemplate();
         exit($exitCode);
     }
     if ($context !== null && $context->getController() !== null) {
         try {
             // check if an exception template was defined for the default output type
             if ($context->getController()->getOutputType()->getExceptionTemplate() !== null) {
                 include $context->getController()->getOutputType()->getExceptionTemplate();
                 exit($exitCode);
             }
         } catch (Exception $e2) {
             unset($e2);
         }
     }
     if ($context !== null && AgaviConfig::get('exception.templates.' . $context->getName()) !== null) {
         // a template was set for this context
         include AgaviConfig::get('exception.templates.' . $context->getName());
         exit($exitCode);
     }
     // include default exception template
     include AgaviConfig::get('exception.default_template');
     // bail out
     exit($exitCode);
 }