* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ConfigManager cm = ConfigManager.getInstance();
/** Security **/
PermissionManager pm = PermissionManager.getInstance();
SessionManager sm = new SessionManager(request.getSession());
if(!pm.hasPermission(sm.getCurrentUser(),PermissionManager.permission.permitGeneralAdministration))
response.sendRedirect("login?redirect=configviewer");
/** End Security **/
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String status = "";
if(request.getParameter("reload")!=null){
cm.reload();
status = "reloaded";
}
if(request.getParameter("rewrite")!=null){
try{
cm.save();
status = "written";
}catch (Exception ex){
status = "could not write config: " + ex.toString();
}
}
out.println("<html>");
out.println("<head>");
out.println("<title>View current configuration</title>");
out.println("</head>");
out.println("<body>");
out.println("<a href=\"admin\">back</a><br/>");
out.println("<h1>Active Configuration </h1>");
out.println(status);
out.println(cm.toHTMLString());
out.println("<form action=\"configviewer?reload\" method=\"POST\"><input type=\"submit\" value=\"reload\"/></form>");
out.println("<form action=\"configviewer?rewrite\" method=\"POST\"><input type=\"submit\" value=\"rewrite\"/></form>");
out.println("</body>");
out.println("</html>");