use of org.b3log.solo.model.sitemap.Sitemap in project solo by b3log.
the class SitemapProcessor method sitemap.
/**
* Returns the sitemap.
*
* @param context the specified context
*/
@RequestProcessing(value = "/sitemap.xml", method = HTTPRequestMethod.GET)
public void sitemap(final HTTPRequestContext context) {
final TextXMLRenderer renderer = new TextXMLRenderer();
context.setRenderer(renderer);
final Sitemap sitemap = new Sitemap();
try {
addArticles(sitemap);
addNavigations(sitemap);
addTags(sitemap);
addArchives(sitemap);
LOGGER.log(Level.INFO, "Generating sitemap....");
final String content = sitemap.toString();
LOGGER.log(Level.INFO, "Generated sitemap");
renderer.setContent(content);
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Get blog article feed error", e);
try {
context.getResponse().sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
} catch (final IOException ex) {
throw new RuntimeException(ex);
}
}
}
Aggregations