jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r1167249 - in /jackrabbit/sandbox/microkernel/src/main: java/org/apache/jackrabbit/mk/server/ resources/org/apache/jackrabbit/mk/server/
Date Fri, 09 Sep 2011 15:30:08 GMT
Author: dpfister
Date: Fri Sep  9 15:30:07 2011
New Revision: 1167249

URL: http://svn.apache.org/viewvc?rev=1167249&view=rev
Log:
HTTP interface to microkernel

Added:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java   (with props)
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java   (with props)
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java   (with props)
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java   (with props)
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/bg-body.png   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/logo.png   (with props)
    jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css   (with props)

Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java (added)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java Fri Sep  9 15:30:07 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.mk.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.jackrabbit.mk.util.IOUtils;
+
+/**
+ * File servlet that will deliver static resources.
+ */
+class FileServlet implements Servlet {
+
+    public void service(Request request, Response response) throws IOException {
+        String file = request.getFile();
+        if (file.endsWith("/")) {
+            file += "index.html";
+        }
+        InputStream in = FileServlet.class.getResourceAsStream(file.substring(1));
+        if (in != null) {
+            int ext = file.lastIndexOf('.');
+            if (ext != -1) {
+                response.setContentTypeByExtension(file.substring(ext + 1));
+            }
+            IOUtils.copy(in, response.getOutputStream());
+        } else {
+            response.setStatusCode(404);
+        }
+    }
+}

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java (added)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java Fri Sep  9 15:30:07 2011
@@ -0,0 +1,127 @@
+package org.apache.jackrabbit.mk.server;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.api.MicroKernelException;
+
+class MicroKernelServlet implements Servlet {
+    
+    private final AtomicReference<MicroKernel> mkref;
+    
+    public MicroKernelServlet(AtomicReference<MicroKernel> mkref) {
+        this.mkref = mkref;
+    }
+    
+    public void service(Request request, Response response) throws IOException {
+        String file = request.getFile();
+        int dotIndex = file.indexOf('.');
+        if (dotIndex == -1) {
+            dotIndex = file.length();
+        }
+        Command command = COMMANDS.get(file.substring(1, dotIndex));
+        if (command != null) {
+            MicroKernel mk = mkref.get();
+            if (mk != null) {
+                try {
+                    command.execute(mk, request, response);
+                } catch (MicroKernelException e) {
+                    response.setStatusCode(500);
+                    e.printStackTrace(new PrintStream(response.getOutputStream()));
+                }
+                return;
+            }
+        }
+        response.setStatusCode(404);
+    }
+    
+    private static interface Command {
+        
+        public void execute(MicroKernel mk, Request request, Response response)
+                throws IOException, MicroKernelException;
+        
+    }
+    
+    private static final Map<String, Command> COMMANDS = new HashMap<String, Command>();
+
+    static {
+        COMMANDS.put("getHeadRevision", new GetHeadRevision());
+        COMMANDS.put("getRevisions", new GetRevisions());
+        COMMANDS.put("getJournal", new GetJournal());
+        COMMANDS.put("getNodes", new GetNodes());
+        COMMANDS.put("commit", new Commit());
+    }
+    
+    static class GetHeadRevision implements Command {
+        
+        public void execute(MicroKernel mk, Request request, Response response)
+                throws IOException, MicroKernelException {
+            
+            response.getOutputStream().write(mk.getHeadRevision().getBytes());
+        }        
+    }
+
+    static class GetRevisions implements Command {
+        
+        public void execute(MicroKernel mk, Request request, Response response)
+                throws IOException, MicroKernelException {
+            
+            long since = request.getParameter("since", 0L);
+            int maxEntries = request.getParameter("max_entries", 10);
+
+            response.getOutputStream().write(mk.getRevisions(since, maxEntries).getBytes());
+        }        
+    }
+    
+    static class GetJournal implements Command {
+
+        public void execute(MicroKernel mk, Request request, Response response)
+                throws IOException, MicroKernelException {
+            
+            String headRevision = mk.getHeadRevision();
+            
+            String fromRevisionId = request.getParameter("from_revision_id", headRevision);
+            String toRevisionId = request.getParameter("to_revision_id", headRevision);
+
+            response.getOutputStream().write(mk.getJournal(fromRevisionId, toRevisionId).getBytes());
+        }        
+    }
+
+    static class GetNodes implements Command {
+
+        public void execute(MicroKernel mk, Request request, Response response)
+                throws IOException, MicroKernelException {
+            
+            String headRevision = mk.getHeadRevision();
+
+            String path = request.getParameter("path", "/");
+            String revisionId = request.getParameter("revision_id", headRevision);
+            int depth = request.getParameter("depth", 1);
+            long offset = request.getParameter("offset", 0L);
+            int count = request.getParameter("count", -1);
+            
+            response.getOutputStream().write(mk.getNodes(path, revisionId, depth, offset, count).getBytes());
+        }        
+    }
+
+    static class Commit implements Command {
+
+        public void execute(MicroKernel mk, Request request, Response response)
+                throws IOException, MicroKernelException {
+            
+            String headRevision = mk.getHeadRevision();
+
+            String path = request.getParameter("path", "/");
+            String jsonDiff = request.getParameter("json_diff");
+            String revisionId = request.getParameter("revision_id", headRevision);
+            String message = request.getParameter("message");
+            
+            String newRevision = mk.commit(path, jsonDiff, revisionId, message);
+            response.getOutputStream().write(newRevision.getBytes());
+        }        
+    }
+}

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java (added)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java Fri Sep  9 15:30:07 2011
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.mk.server;
+
+import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.jackrabbit.mk.util.IOUtils;
+
+class Request {
+
+    private InputStream in;
+    private final String method;
+    private final String file;
+    private String queryString;
+    private final Map<String,String> headers; 
+    private Map<String, String> params;
+    private boolean chunked;
+    private InputStreamImpl reqIn;
+    
+    private Request(String method, String uri, Map<String,String> headers, InputStream in) {
+        this.method = method;
+        
+        int index = uri.lastIndexOf('?');
+        if (index == -1) {
+            file = uri;
+        } else {
+            file = uri.substring(0, index);
+            queryString = uri.substring(index + 1);
+        }
+        
+        this.headers = headers;
+        this.in = in;
+    }
+    
+    public static Request parse(InputStream in) throws IOException {
+        String requestLine = readLine(in);
+        
+        String[] parts = requestLine.split(" ");
+        if (parts.length != 3) {
+            return null;
+        }
+        String method = parts[0];
+        String uri = parts[1];
+        
+        Map<String, String> headers = new HashMap<String, String>();
+        
+        for (;;) {
+            String headerLine = readLine(in);
+            if (headerLine.length() == 0) {
+                break;
+            }
+            parts = headerLine.split(":");
+            if (parts.length == 2) {
+                headers.put(parts[0].trim(), parts[1].trim());
+            }
+        }
+        return new Request(method, uri, headers, in);
+    }
+    
+    /**
+     * Read a single line, terminated by a CR LF combination from the socket
+     * input.
+     * 
+     * @return line
+     * @throws IOException if an I/O error occurs
+     */
+    private static String readLine(InputStream in) throws IOException {
+        StringBuilder line = new StringBuilder(128);
+        
+        for (;;) {
+            int c = in.read();
+            switch (c) {
+            case '\r':
+                // swallow
+                break;
+            case '\n':
+                return line.toString();
+            case -1:
+                throw new EOFException();
+            default:
+                line.append((char) c);
+            }
+        }
+    }
+    
+    public String getMethod() {
+        return method;
+    }
+
+    public String getFile() {
+        return file;
+    }
+    
+    public String getContentType() {
+        return headers.get("Content-Type");
+    }
+    
+    public int getContentLength() {
+        String s = headers.get("Content-Length");
+        if (s != null) {
+            try {
+                return Integer.parseInt(s);
+            } catch (RuntimeException e) {
+                /* ignore */
+            }
+        }
+        return -1;
+    }
+    
+    public String getQueryString() {
+        return queryString;
+    }
+
+    public String getParameter(String name) throws IOException {
+        if (params == null) {
+            params = new HashMap<String, String>();
+            
+            String contentType = getContentType();
+            if ("application/x-www-form-urlencoded".equals(contentType)) {
+                ByteArrayOutputStream out = new ByteArrayOutputStream();
+                IOUtils.copy(getInputStream(), out);
+                collectParameters(out.toString(), params);
+            }
+        }
+        return params.get(name);
+    }
+    
+    public String getParameter(String name, String defaultValue) throws IOException {
+        String s = getParameter(name);
+        if (s != null) {
+            return s;
+        }
+        return defaultValue;
+    }
+
+    public int getParameter(String name, int defaultValue) throws IOException {
+        String s = getParameter(name);
+        if (s != null) {
+            try {
+                return Integer.parseInt(s);
+            } catch (RuntimeException e) {
+                /* ignore */
+            }
+        }
+        return defaultValue;
+    }
+
+    public long getParameter(String name, long defaultValue) throws IOException {
+        String s = getParameter(name);
+        if (s != null) {
+            try {
+                return Long.parseLong(s);
+            } catch (RuntimeException e) {
+                /* ignore */
+            }
+        }
+        return defaultValue;
+    }
+    
+    private static void collectParameters(String s, Map<String,String> map) {
+        for (String param : s.split("&")) {
+            String[] nv = param.split("=");
+            if (nv.length == 2) {
+                map.put(URLDecoder.decode(nv[0]), URLDecoder.decode(nv[1]));
+            }
+        }
+    }
+    
+    public InputStream getInputStream() throws IOException {
+        if (reqIn == null) {
+            // TODO: handle chunked
+            int contentLength = getContentLength();
+            if (contentLength == -1) {
+                contentLength = 0;
+            }
+            reqIn = new InputStreamImpl(contentLength);
+        }
+        return reqIn;
+    }
+    
+    private int readChunk(byte[] b, int off, int len) throws IOException {
+        if (in == null) {
+            return -1;
+        }
+        if (chunked) {
+            // TODO: handle chunked
+            return -1;
+        } else {
+            return in.read(b, off, len);
+        }
+    }
+    
+    void finish() {
+        // TODO finish reading input stream if bytes are left
+        
+        in = null;
+    }
+    
+    /**
+     * Internal <code>InputStream</code> passed to servlet handlers.
+     */
+    private class InputStreamImpl extends InputStream {
+        
+        private final int limit;
+        private int count;
+        
+        public InputStreamImpl(int limit) {
+            this.limit = limit;
+        }
+        
+        @Override
+        public int read() throws IOException {
+            if (count < limit) {
+                byte[] b = new byte[1];
+                if (readChunk(b, 0, b.length) == 1) {
+                    count++;
+                    return b[1] & 0xff;
+                }
+            }
+            return -1;
+        }
+        
+        @Override
+        public int read(byte[] b, int off, int len) throws IOException {
+            if (count < limit) {
+                if (limit - count < len) {
+                    len = limit - count;
+                }
+                int n = readChunk(b, off, len);
+                if (n > 0) {
+                    count += n;
+                }
+                return n;
+            }
+            return -1;
+        }
+    }
+}

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java (added)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java Fri Sep  9 15:30:07 2011
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.mk.server;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.HashMap;
+
+import org.apache.jackrabbit.mk.util.IOUtils;
+
+class Response {
+    
+    private OutputStream out;
+    private boolean headersSent;
+    private boolean committed;
+    private boolean chunked;
+    private int statusCode;
+    private String contentType;
+    private OutputStreamImpl respOut;
+    
+    public Response(OutputStream out) {
+        this.out = out;
+    }
+    
+    /**
+     * Return the status message associated with a status code.
+     * 
+     * @param sc status code
+     * @return associated status message
+     */
+    private static String getStatusMsg(int sc) {
+        switch (sc) {
+        case 200:
+            return "OK";
+        case 400:
+            return "Bad request";
+        case 404:
+            return "Not found";
+        default:
+            return "Internal server error";
+        }
+    }
+    
+    private void sendHeaders() throws IOException {
+        if (headersSent) {
+            return;
+        }
+        
+        headersSent = true;
+        
+        int sc = this.statusCode;
+        if (sc == 0) {
+            sc = 200;
+        }
+        String msg = getStatusMsg(sc);
+        if (sc != 200 && respOut == null) {
+            /* Generate standard message for errors */
+            String body = String.format(
+                    "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" +
+                    "<html><head>" +
+                    "<title>%d %s</title>" +
+                    "</head><body>" +
+                    "<h1>%s</h1>" +
+                    "</body></html>", sc, msg, msg);
+            setContentType("text/html");
+            getOutputStream().write(body.getBytes());
+        }
+        
+        writeLine(String.format("HTTP/1.1 %d %s", sc, msg));
+        
+        if (respOut != null) {
+            if (committed) {
+                writeLine(String.format("Content-Length: %d", respOut.getCount()));
+            } else {
+                chunked = true;
+                writeLine("Transfer-Encoding: chunked");
+            }
+        }
+        if (contentType != null) {
+            writeLine(String.format("Content-Type: %s", contentType));
+        }
+        writeLine("Connection: Close");
+        writeLine("");
+    }
+
+    public void finish() throws IOException {
+        committed = true;
+        
+        try {
+            sendHeaders();
+            IOUtils.closeQuietly(respOut);
+        } finally {
+            out = null;
+        }
+    }
+    
+    private void writeLine(String s) throws IOException {
+        if (out != null) {
+            out.write(s.getBytes());
+            out.write("\r\n".getBytes());
+        }
+    }
+
+    private void writeChunk(byte[] b, int off, int len) throws IOException {
+        sendHeaders();
+
+        if (out != null) {
+            if (chunked) {
+                out.write(String.format("%04X\r\n", len).getBytes());
+            }
+            out.write(b, off, len);
+            if (chunked) {
+                out.write(("\r\n").getBytes());
+            }
+        }
+    }
+    
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
+    public void setContentTypeByExtension(String ext) {
+        String contentType = MIME_TYPES.get(ext);
+        if (contentType == null) {
+            contentType = "application/octet-stream";
+        }
+        setContentType(contentType);
+    }
+
+    
+    private static final HashMap<String, String> MIME_TYPES = new HashMap<String, String>();
+    
+    static {
+        MIME_TYPES.put("html", "text/html");
+        MIME_TYPES.put("css", "text/css");
+        MIME_TYPES.put("js", "application/javascript");
+        MIME_TYPES.put("json", "application/json");
+        MIME_TYPES.put("png", "image/png");
+    }
+    
+    public OutputStream getOutputStream() {
+        if (respOut == null) {
+            respOut = new OutputStreamImpl();
+        }
+        return respOut;
+    }
+
+    public void setStatusCode(int sc) {
+        this.statusCode = sc;
+    }
+    
+    /**
+     * Internal <code>OutputStream</code> passed to servlet handlers.
+     */
+    private class OutputStreamImpl extends OutputStream {
+        
+        private final byte[] buf = new byte[8192];
+        private int count;
+
+        /**
+         * Return the number of valid bytes in the buffer.
+         * 
+         * @return number of bytes 
+         */
+        public int getCount() {
+            return count;
+        }
+
+        @Override
+        public void write(int b) throws IOException {
+            if (count == buf.length) {
+                writeChunk(buf, 0, count);
+                count = 0;
+            }
+            buf[count++] = (byte) b;
+        }
+
+        @Override
+        public void write(byte[] b, int off, int len) throws IOException {
+            if (len + count > buf.length) {
+                if (count > 0) {
+                    writeChunk(buf, 0, count);
+                    count = 0;
+                }
+            }
+            if (len > buf.length) {
+                writeChunk(b, off, len);
+            } else {
+                System.arraycopy(b, off, buf, count, len);
+                count += len;
+            }
+        }
+        
+        @Override
+        public void flush() throws IOException {
+            if (count > 0) {
+                writeChunk(buf, 0, count);
+                count = 0;
+            }
+        }
+        
+        @Override
+        public void close() throws IOException {
+            flush();
+            
+            writeChunk(buf, 0, 0);
+        }
+    }
+}

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java (added)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java Fri Sep  9 15:30:07 2011
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.mk.server;
+
+import java.io.IOException;
+
+interface Servlet {
+
+    public void service(Request request, Response response) throws IOException;
+}

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/bg-body.png
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/bg-body.png?rev=1167249&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/bg-body.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html Fri Sep  9 15:30:07 2011
@@ -0,0 +1,41 @@
+<html>
+<head>
+<title>&micro;icroKernel prototype: commit</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
+<link rel="stylesheet" type="text/css" href="main.css"></link>
+</head>
+
+<body>
+    <script src="header.js"></script>
+    <div class="content">
+        <h1>Write Operations: commit</h1>
+        <form method="POST" target="result">
+        <table class="formtable">
+            <tr>
+                <td>Path</td>
+                <td><input class="text" type="text" name="path" id="path" value="/"></td>
+            </tr>
+            <tr>
+                <td>JSON Diff</td>
+                <td><input class="text" type="text" name="json_diff" id="revision_id"
+                   value='+"test" : {"jcr:primaryType":"nt:unstructured"}'>
+                </td>
+            </tr>
+            <tr>
+                <td>Revision ID</td>
+                <td><input class="text" type="text" name="revision_id" id="revision_id" value=""></td>
+            </tr>
+            <tr>
+                <td>Message</td>
+                <td><input class="text" type="text" name="message" id="message" value=""></td>
+            </tr>
+            <tr><td>&nbsp;</td><td>
+            <input type="submit"><br></td></tr></table>
+        </form>
+        <p>
+            <iframe name="result" height="400" width="950" src="about:blank"></iframe>
+        </p>
+        <script src="footer.js"></script>
+    </div>
+</body>
+</html>

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js Fri Sep  9 15:30:07 2011
@@ -0,0 +1,2 @@
+document.write('<div class="footer"><a href="http://www.apache.org/licenses/">License</a> | Powered by <a href="http://jackrabbit.apache.org/">Apache Jackrabbit</a></div>');
+

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html Fri Sep  9 15:30:07 2011
@@ -0,0 +1,23 @@
+<html>
+<head>
+<title>&micro;icroKernel prototype: getHeadRevision</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
+<link rel="stylesheet" type="text/css" href="main.css"></link>
+</head>
+
+<body>
+    <script src="header.js"></script>
+    <div class="content">
+        <h1>Revision Operations: getHeadRevision</h1>
+        <form method="POST" target="result">
+            <table class="formtable">
+            <tr><td>&nbsp;</td><td>
+            <input type="submit"><br></td></tr></table>
+        </form>
+        <p>
+            <iframe name="result" height="400" width="950" src="about:blank"></iframe>
+        </p>
+        <script src="footer.js"></script>
+    </div>
+</body>
+</html>

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html Fri Sep  9 15:30:07 2011
@@ -0,0 +1,31 @@
+<html>
+<head>
+<title>&micro;icroKernel prototype: getJournal</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
+<link rel="stylesheet" type="text/css" href="main.css"></link>
+</head>
+
+<body>
+    <script src="header.js"></script>
+    <div class="content">
+        <h1>Revision Operations: getJournal</h1>
+        <form method="POST" target="result">
+        <table class="formtable">
+            <tr>
+                <td>From Revision ID</td>
+                <td><input class="text" type="text" name="from_revision_id" id="from_revision_id" value=""></td>
+            </tr>
+            <tr>
+                <td>To Revision ID</td>
+                <td><input class="text" type="text" name="to_revision_id" id="to_revision_id" value=""></td>
+            </tr>
+            <tr><td>&nbsp;</td><td>
+            <input type="submit"><br></td></tr></table>
+        </form>
+        <p>
+            <iframe name="result" height="400" width="950" src="about:blank"></iframe>
+        </p>
+        <script src="footer.js"></script>
+    </div>
+</body>
+</html>

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html Fri Sep  9 15:30:07 2011
@@ -0,0 +1,43 @@
+<html>
+<head>
+<title>&micro;icroKernel prototype: getNodes</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
+<link rel="stylesheet" type="text/css" href="main.css"></link>
+</head>
+
+<body>
+    <script src="header.js"></script>
+    <div class="content">
+        <h1>Read Operations: getNodes</h1>
+        <form method="POST" target="result">
+        <table class="formtable">
+            <tr>
+                <td>Path</td>
+                <td><input class="text" type="text" name="path" id="path" value="/"></td>
+            </tr>
+            <tr>
+                <td>Revision ID</td>
+                <td><input class="text" type="text" name="revision_id" id="revision_id" value=""></td>
+            </tr>
+            <tr>
+                <td>Depth</td>
+                <td><input class="text" type="text" name="depth" id="depth" value="1"></td>
+            </tr>
+            <tr>
+                <td>Offset</td>
+                <td><input class="text" type="text" name="offset" id="offset" value="0"></td>
+            </tr>
+            <tr>
+                <td>Count</td>
+                <td><input class="text" type="text" name="count" id="count" value="-1"></td>
+            </tr>
+            <tr><td>&nbsp;</td><td>
+            <input type="submit"><br></td></tr></table>
+        </form>
+        <p>
+            <iframe name="result" height="400" width="950" src="about:blank"></iframe>
+        </p>
+        <script src="footer.js"></script>
+    </div>
+</body>
+</html>

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html Fri Sep  9 15:30:07 2011
@@ -0,0 +1,31 @@
+<html>
+<head>
+<title>&micro;icroKernel prototype: getRevisions</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
+<link rel="stylesheet" type="text/css" href="main.css"></link>
+</head>
+
+<body>
+    <script src="header.js"></script>
+    <div class="content">
+        <h1>Revision Operations: getRevisions</h1>
+        <form method="POST" target="result">
+        <table class="formtable">
+            <tr>
+                <td>Since</td>
+                <td><input class="text" type="text" name="since" id="since" value="0"></td>
+            </tr>
+            <tr>
+                <td>Max Entries</td>
+                <td><input class="text" type="text" name="max_entries" id=""max_entries" value="10"></td>
+            </tr>
+            <tr><td>&nbsp;</td><td>
+            <input type="submit"><br></td></tr></table>
+        </form>
+        <p>
+            <iframe name="result" height="400" width="950" src="about:blank"></iframe>
+        </p>
+        <script src="footer.js"></script>
+    </div>
+</body>
+</html>

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js Fri Sep  9 15:30:07 2011
@@ -0,0 +1 @@
+document.write('<div class="header"><div class="logo"><a href="http://jackrabbit.apache.org/" align="right"><img src="logo.png" align="right"></a></div><a href="index.html">&micro;icrokernel</a><br>prototype</div>');

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html Fri Sep  9 15:30:07 2011
@@ -0,0 +1,33 @@
+<html>
+<head>
+<title>&micro;icroKernel prototype</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
+<link rel="stylesheet" type="text/css" href="main.css"></link>
+</head>
+
+<body>
+<script src="header.js"></script>
+<div class="content">
+<p>
+	<h4>Revision Operations</h4>
+	<a href="getHeadRevision.html">getHeadRevision</a><br>
+	<a href="getRevisions.html">getRevisions</a><br>
+	<a href="waitForCommit.html">waitForCommit</a><br>
+	<a href="getJournal.html">getJournal</a><br>
+	
+	<h4>Read Operations</h4> 
+	<a href="nodeExists.html">nodeExists</a><br>
+	<a href="getNodes.html">getNodes</a><br>
+	
+	<h4>Write Operations</h4> 
+	<a href="commit.html">commit</a><br>
+	
+	<h4>Blob Operations</h4> 
+	<a href="getLength.html">getLength</a><br>
+	<a href="read.html">read</a><br>
+	<a href="write.html">write</a><br>
+</p>
+</div>
+<script src="footer.js"></script>
+</div>
+</html>

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/logo.png
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/logo.png?rev=1167249&view=auto
==============================================================================
Binary file - no diff available.

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/logo.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css?rev=1167249&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css (added)
+++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css Fri Sep  9 15:30:07 2011
@@ -0,0 +1,150 @@
+body {
+	background: #eee url(bg-body.png) top center repeat-y;
+	color: #333;
+	font-family: Georgia, Times New Roman;
+	margin: 0 auto 0;
+	padding: 0;
+}
+
+.logo {
+	float: right;
+}
+
+.twocols {
+	background: #eee url(bg-twocols.png) top center repeat-y;
+}
+
+a, a:visited {
+	color: #58a;
+	text-decoration: none;
+}
+
+a:hover {
+	background-color: #ffc;
+	text-decoration: underline;
+}
+
+img {
+	border-style: none;
+}
+
+.header {
+	background: #fff;
+	margin: 0 auto 0;
+	text-align: left;
+	padding: 9px 0 29px 0;
+	width: 960px;
+	border-top: 10px solid #ccc;
+}
+
+.header a {
+	font-family: Helvetica, Verdana;
+	letter-spacing: -1px;
+	font-size: 31px;
+	font-weight: bold;
+	color: #58a;
+	text-decoration: none;
+	padding: 0 10px 0 0;
+	margin: 0;
+}
+
+.header a:hover {
+	color: #69d;
+	text-decoration: underline;
+}
+
+.leftcol {
+	width: 440px;
+	margin: 0 20px 0 0;
+	padding: 5px 0 5px 0;
+}
+
+.rightcol {
+	width: 440px;
+	margin: 0 20px 0 0;
+	padding: 5px 0 5px 0;
+}
+
+.formtable {
+	margin-top: 20px;
+	width: 600px;
+	padding: 0;
+	clear: both;
+}
+
+.formtable td {
+	padding: 5px;
+	width: 300px;
+	border-top: dotted #ddd 1px;
+}
+
+.formtable input.text {
+	width: 300px;
+}
+
+
+.content {
+	width: 960px;
+	margin: 0 auto 0;
+	padding: 0;
+	clear: both;
+}
+
+.content p {
+	padding: 0 0 15px 0;
+	margin: 0;
+	line-height: 20px;
+	font-size: 14px;
+}
+
+.content p img {
+	float: left;
+	border: none;
+	margin-right: 15px;
+	margin-bottom: 10px;
+}
+
+.content h1 {
+	border-top: 2px solid olive;
+	color: #58a;
+	font-family: Helvetica,Verdana;
+	font-size: 18px;
+	font-weight: bold;
+	line-height: 20px;
+	margin: 0;
+	padding: 5px 0;
+}
+
+.content h1 a {
+	color: #58a;
+	margin-left: -5px;
+	padding: 0 10px 0 5px;
+	text-decoration: none;
+}
+
+.content h1 a:hover {
+	background-color: #ffc;
+	color: #68b;
+}
+
+.content h2 {
+	color: olive;
+	font-size: 12px;
+	font-family: Helvetica, Verdana;
+	font-weight: bold;
+	margin: 20px 0 5px 0;
+	padding: 3px 0 3px 0;
+	border-top: 2px solid olive;
+	border-bottom: 1px dotted #ccc;
+}
+
+.footer {
+	font-size: 12px;
+	background: #fff;
+	width: 960px;
+	margin: 0 auto 0;
+	padding: 10px 0 10px 0;
+	text-align: left;
+	border-top: 1px solid #ccc;
+	clear: both;
+}
\ No newline at end of file

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url



Mime
View raw message