Weblogger roller = WebloggerFactory.getWeblogger();
try {
response.setContentType("text/html; charset=utf-8");
WeblogManager wmgr = roller.getWeblogManager();
Weblog website = null;
// website handle is always the first path segment,
// only throw an exception when not found if we have a tag prefix
if(handle != null) {
try {
UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
website = umgr.getWebsiteByHandle(handle, Boolean.TRUE);
if (website == null)
throw new WebloggerException();
} catch (WebloggerException ex) {
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Weblog handle not found.");
return;
}
}
List tags = wmgr.getTags(website, null, prefix, limit);
response.getWriter().println("{");
response.getWriter().print(" prefix : \"");
response.getWriter().print(prefix == null ? "" : prefix);
response.getWriter().println("\",");