jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1331982 - in /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run: Main.java RepositoryServlet.java
Date Sun, 29 Apr 2012 19:39:02 GMT
Author: jukka
Date: Sun Apr 29 19:39:01 2012
New Revision: 1331982

URL: http://svn.apache.org/viewvc?rev=1331982&view=rev
Log:
OAK-76: Initial content in oak-run

Hard-code credentials until we have proper authentication in place

Modified:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java?rev=1331982&r1=1331981&r2=1331982&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java Sun
Apr 29 19:39:01 2012
@@ -73,31 +73,28 @@ public class Main {
 
     public static class HttpServer {
 
-        private Server server;
+        private final ServletContextHandler context;
+
+        private final Server server;
 
         public HttpServer(String uri, String args[]) {
-            ServletContextHandler context = new ServletContextHandler(
-                    ServletContextHandler.SECURITY);
+            context = new ServletContextHandler(ServletContextHandler.SECURITY);
             context.setContextPath("/");
 
             if (args.length == 0) {
                 System.out.println("Starting an in-memory repository");
                 System.out.println(URI + " -> [memory]");
-                Servlet servlet = new RepositoryServlet(null);
-                context.addServlet(new ServletHolder(servlet), "/*");
+                addServlet(null, "/*");
             } else if (args.length == 1) {
                 System.out.println("Starting a standalone repository");
                 System.out.println(URI + " -> " + args[0]);
-                Servlet servlet = new RepositoryServlet(args[0]);
-                context.addServlet(new ServletHolder(servlet), "/*");
+                addServlet(args[0], "/*");
             } else {
                 System.out.println("Starting a clustered repository");
                 for (int i = 0; i < args.length; i++) {
                     // FIXME: Use a clustered MicroKernel implementation
                     System.out.println(URI + "/node" + i + "/ -> " + args[i]);
-                    Servlet servlet = new RepositoryServlet(args[i]);
-                    context.addServlet(new ServletHolder(servlet), "/node" + i
-                            + "/*");
+                    addServlet(args[i], "/node" + i + "/*");
                 }
             }
 
@@ -116,6 +113,16 @@ public class Main {
         public void stop() throws Exception {
             server.stop();
         }
+
+        private void addServlet(String repo, String path) {
+            Servlet servlet = new RepositoryServlet(repo);
+            ServletHolder holder = new ServletHolder(servlet);
+            holder.setInitParameter(
+                    RepositoryServlet.INIT_PARAM_MISSING_AUTH_MAPPING,
+                    "admin:admin");
+            context.addServlet(holder, path);
+        }
+
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java?rev=1331982&r1=1331981&r2=1331982&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java
Sun Apr 29 19:39:01 2012
@@ -50,6 +50,7 @@ class RepositoryServlet extends JCRWebda
         } catch (RepositoryException e) {
             throw new ServletException("Could not start a repository", e);
         }
+
         super.init();
     }
 



Mime
View raw message