コード例 #1
0
ファイル: GetNodes.java プロジェクト: sschafer/atomic
 @Override
 protected void execute(
     final @NonNull KernelHttpRequest request, final @NonNull KernelHttpResponse response) {
   if (!request.isPrivileged()) throw new AdminAccessException();
   final String queryType = request.getParameter("queryType");
   final PrintWriter writer = response.getWriter();
   writer.print("[");
   try {
     final ValidatingKernel kernel = getKernel();
     final BeginTransactionResult btr = kernel.beginTransaction();
     final NodesTransaction txn = btr.getTxn();
     boolean commit = false;
     try {
       final Processor processor = processors.get(queryType);
       if (processor == null) writer.println("Query type '" + queryType + "' not found");
       else processor.process(txn, request, writer);
       commit = true;
     } finally {
       txn.finish(commit);
     }
     writer.print("]");
   } finally {
     writer.close();
   }
 }
コード例 #2
0
 @Override
 protected void execute(
     final @NonNull KernelHttpRequest request, final @NonNull KernelHttpResponse response) {
   final SecurityContextProvider scp = scpReactor.getInstance();
   response.setContentType("text/html");
   final PrintWriter writer = response.getWriter();
   try {
     writer.println("<html>");
     writer.println("<head>");
     writer.println("<title>Security Contexts</title>");
     writer.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"/ami.css\"/>");
     writer.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"/displayLinks.css\"/>");
     writer.println("</head>");
     writer.println("<body>");
     writer.println("<table>");
     writer.println("<tbody>");
     writer.println("<tr>");
     writer.println("<td>Users Context</td>");
     writer.println("<td>");
     writer.println(scp.getUsersContext());
     writer.println("</td>");
     writer.println("</tr>");
     writer.println("<tr>");
     writer.println("<td>Roles Context</td>");
     writer.println("<td>");
     writer.println(scp.getRolesContext());
     writer.println("</td>");
     writer.println("</tr>");
     writer.println("<tr>");
     writer.println("<td>Anonymous User</td>");
     writer.println("<td>");
     writer.println(scp.getAnonymousUserNodeId());
     writer.println("</td>");
     writer.println("</tr>");
     writer.println("<tr>");
     writer.println("<td>Public Role</td>");
     writer.println("<td>");
     writer.println(scp.getPublicRoleNodeId());
     writer.println("</td>");
     writer.println("</tr>");
     writer.println("</tbody>");
     writer.println("</table>");
     writer.println("</body>");
     writer.println("</html>");
   } finally {
     writer.close();
   }
 }