private void handleRSS(HttpServletRequest req, HttpServletResponse res, Site site, String slug)
      throws IOException, XMLStreamException, ServletException {
    slug = slug.replaceFirst("/", "");

    Locale locale =
        Strings.isNullOrEmpty(req.getParameter("locale"))
            ? I18N.getLocale()
            : new Locale.Builder().setLanguageTag(req.getParameter("locale")).build();

    String[] parts = slug.split("/");

    if (parts.length == 1) {
      res.setContentType("application/rss+xml;charset=UTF-8");
      res.getOutputStream()
          .write(RSSService.generateRSSForSite(site, locale).getBytes(StandardCharsets.UTF_8));
    } else {
      Category category = site.categoryForSlug(parts[1]);
      if (category == null) {
        errorPage(req, res, site, 404);
      } else {
        res.setContentType("application/rss+xml;charset=UTF-8");
        res.getOutputStream()
            .write(
                RSSService.generateRSSForCategory(category, locale)
                    .getBytes(StandardCharsets.UTF_8));
      }
    }
  }
 private Map<String, Object> makeAppWrapper() {
   HashMap<String, Object> result = new HashMap<String, Object>();
   PortalConfiguration configuration = PortalConfiguration.getInstance();
   result.put("title", configuration.getApplicationTitle());
   result.put("subtitle", configuration.getApplicationSubTitle());
   result.put("copyright", configuration.getApplicationCopyright());
   result.put("support", configuration.getSupportEmailAddress());
   result.put("locale", I18N.getLocale());
   result.put("supportedLocales", CoreConfiguration.supportedLocales());
   return result;
 }
 public String getLocalizedName() {
   return getLocalizedName(I18N.getLocale());
 }