private void sendIndex(SlingHttpServletResponse response) throws IOException { PrintWriter writer = response.getWriter(); writer.append(DocumentationConstants.HTML_HEADER); writer.append("<h1>List of Services</h1>"); writer.append("<ul>"); Map<String, ServletDocumentation> m = servletTracker.getServletDocumentation(); List<ServletDocumentation> o = new ArrayList<ServletDocumentation>(m.values()); Collections.sort(o); for (ServletDocumentation k : o) { if (k.isDocumentationServlet()) { String key = k.getKey(); if (key != null) { writer.append("<li><a href=\""); writer.append(k.getUrl()); writer.append("\">"); writer.append(k.getServiceDocumentationName()); writer.append("</a><p>"); writer.append(k.getShortDescription()); writer.append("</p></li>"); } } } writer.append("</ul>"); writer.append(DocumentationConstants.HTML_FOOTER); }
protected void deactivate(ComponentContext context) { if (servletTracker != null) { servletTracker.close(); servletTracker = null; } }
protected void activate(ComponentContext context) { BundleContext bundleContext = context.getBundleContext(); servletTracker = new ServletDocumentationTracker(bundleContext); servletTracker.open(); }