@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
DocumentBuilder dbuilder;
try {
dbuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
JrdsDocument hostDom = new JrdsDocument(dbuilder.newDocument());
hostDom.doRootElement("div");
for(DiscoverAgent da: getHostsList().getDiscoverAgent()) {
logger.debug(jrds.Util.delayedFormatString("Adding discover agent %s", da));
da.doHtmlDiscoverFields(hostDom);
}
resp.setContentType(CONTENT_TYPE);
Map<String, String> prop = new HashMap<String, String>(1);
prop.put(OutputKeys.OMIT_XML_DECLARATION, "no");
prop.put(OutputKeys.INDENT, "yes");
prop.put("{http://xml.apache.org/xslt}indent-amount", "4");
Util.serialize(hostDom, resp.getOutputStream(), null, prop);
} catch (ParserConfigurationException e) {
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Parser configuration error");
} catch (TransformerException e) {
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Transformer exception error");
}
}