@At("/sitemap") //google实际访问的URI是 /sitemap.xml , 不过@At里面的值是绝对不能后缀的,因为它只会去匹配去除后缀的URI
@Ok("void")
public void sitemap(HttpServletRequest req, HttpServletResponse resp) throws IOException {
DBCursor cur = questionColl.find(new BasicDBObject(), new BasicDBObject("updateAt", 1)).sort(new BasicDBObject("createAt", -1));
Tag urlset = Tag.tag("urlset");
urlset.attr("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9")
.attr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
.attr("xsi:schemaLocation", "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd");
urlset.add("url").add("loc").setText("http://" + req.getHeader("Host"));