/**
   * Overriding doGet from FreemarkerHttpController to do a page template (as opposed to body
   * template) style output for XML requests.
   *
   * <p>This follows the pattern in AutocompleteController.java.
   */
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    boolean wasXmlRequested = isRequesedFormatXml(request);
    if (!wasXmlRequested) {
      super.doGet(request, response);
    } else {
      VitroRequest vreq = new VitroRequest(request);
      Configuration config = getConfig(vreq);
      ResponseValues rvalues = processRequest(vreq);

      response.setCharacterEncoding("UTF-8");
      response.setContentType("text/xml;charset=UTF-8");
      writeTemplate(rvalues.getTemplateName(), rvalues.getMap(), config, request, response);
    }
  }
 protected StringWriter processTemplate(ResponseValues values) throws TemplateProcessingException {
   if (values == null) {
     return null;
   }
   return processTemplate(values.getTemplateName(), values.getMap());
 }