protected function getTemplateFile(Response $response) {
    if (self::$sharedView == null) {
      self::$sharedView = ObjectFactory::getInstance('view');
    }
    // check if a view template is defined
    $viewTpl = self::$sharedView->getTemplate($response->getSender(),
                  $response->getContext(), $response->getAction());
    if (!$viewTpl) {
      throw new ConfigurationException("View definition missing for ".
                  "response: ".$response->__toString());
    }

    // check for html_format property in response
    // and add the suffix if existing
    $viewTplFile = WCMF_BASE.$viewTpl;
    $format = $response->getProperty('html_tpl_format');
    if (isset($format)) {
      $ext = pathinfo($viewTplFile, PATHINFO_EXTENSION);
      $formatViewTplFile = dirname($viewTplFile).'/'.basename($viewTplFile, ".$ext").'-'.$format.'.'.$ext;
    }

    // give precedence to format specific file
    $finalTplFile = isset($formatViewTplFile) && file_exists($formatViewTplFile) ?
            $formatViewTplFile : $viewTplFile;
    return $finalTplFile;
  }