Return-Path: Delivered-To: apmail-incubator-sling-commits-archive@locus.apache.org Received: (qmail 16711 invoked from network); 16 Jan 2008 16:52:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jan 2008 16:52:37 -0000 Received: (qmail 15869 invoked by uid 500); 16 Jan 2008 16:52:27 -0000 Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org Received: (qmail 15843 invoked by uid 500); 16 Jan 2008 16:52:26 -0000 Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sling-dev@incubator.apache.org Delivered-To: mailing list sling-commits@incubator.apache.org Received: (qmail 15834 invoked by uid 99); 16 Jan 2008 16:52:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jan 2008 08:52:26 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jan 2008 16:52:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B86801A9838; Wed, 16 Jan 2008 08:52:01 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r612506 - in /incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sling/ src/main/java/org/apache/sling/jcr/ src/main/java/org/apach... Date: Wed, 16 Jan 2008 16:51:57 -0000 To: sling-commits@incubator.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080116165201.B86801A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fmeschbe Date: Wed Jan 16 08:51:50 2008 New Revision: 612506 URL: http://svn.apache.org/viewvc?rev=612506&view=rev Log: SLING-150 Add support for Jackrabbit Simple WebDAV Added: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/ (with props) incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml (with props) incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java (with props) incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/resources/ Propchange: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Jan 16 08:51:50 2008 @@ -0,0 +1,4 @@ +.classpath +.project +target +.settings Added: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml?rev=612506&view=auto ============================================================================== --- incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml (added) +++ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml Wed Jan 16 08:51:50 2008 @@ -0,0 +1,129 @@ + + + + 4.0.0 + + org.apache.sling + sling + 1-incubator-SNAPSHOT + ../../parent/pom.xml + + + org.apache.sling.jcr.webdav + bundle + 2.0.0-incubator-SNAPSHOT + + Sling - Simple WebDAV Access to repositories + + Bundle to access JCR repositories over WebDAV + + + + + scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/webdav + + + scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/webdav + + + http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav + + + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + sling,jcr + + + org.apache.sling.jcr.webdav, + org.apache.jackrabbit.webdav.simple, + org.apache.jackrabbit.server, + org.apache.jackrabbit.server.io, + org.apache.jackrabbit.server.jcr, + org.apache.jackrabbit.webdav.*, , + org.apache.xml.serialize, + org.apache.xerces.* + + + javax.transaction.xa; javax.xml.*; + org.apache.xml.resolver.*;org.w3c.*; + org.xml.sax.*;resolution:=optional, + !sun.*,* + + + + + + + + + + org.apache.sling + org.apache.sling.jcr.api + 2.0.0-incubator-SNAPSHOT + + + + org.apache.jackrabbit + jackrabbit-jcr-server + 1.4 + compile + + + + org.apache.jackrabbit + jackrabbit-webdav + 1.4 + compile + + + + javax.servlet + servlet-api + + + + org.slf4j + slf4j-simple + + + + + org.osgi + osgi_R4_core + + + org.osgi + osgi_R4_compendium + + + Propchange: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java?rev=612506&view=auto ============================================================================== --- incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java (added) +++ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java Wed Jan 16 08:51:50 2008 @@ -0,0 +1,115 @@ +/* + * 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.sling.jcr.webdav; + +import java.util.Dictionary; +import java.util.Hashtable; + +import javax.jcr.Repository; +import javax.servlet.ServletException; + +import org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet; +import org.apache.sling.jcr.api.SlingRepository; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.http.HttpService; +import org.osgi.service.http.NamespaceException; + +/** + * The SimpleWebDavServlet + * + * @scr.component + */ +public class SimpleWebDavServlet extends SimpleWebdavServlet { + + /** @scr.property value="/dav" */ + private static final String PROP_CONTEXT = "dav.root"; + + /** @scr.property value="Sling WebDAV" */ + private static final String PROP_REALM = "dav.realm"; + + private static final String DEFAULT_CONTEXT = "/dav"; + + /** @scr.reference */ + private HttpService httpService; + + /** @scr.reference */ + private SlingRepository repository; + + // the alias under which the servlet is registered, null if not + private String contextPath; + + @Override + public Repository getRepository() { + return repository; + } + + // ---------- SCR integration ---------------------------------------------- + + protected void activate(ComponentContext componentContext) { + Dictionary props = componentContext.getProperties(); + + String context = getString(props, PROP_CONTEXT, DEFAULT_CONTEXT); + + Dictionary initparams = new Hashtable(); + + initparams.put(INIT_PARAM_RESOURCE_PATH_PREFIX, context); + + String value = getString(props, PROP_REALM, null); + if (value != null) { + initparams.put(INIT_PARAM_AUTHENTICATE_HEADER, "Basic Realm=\"" + + value + "\""); + } + +// value = getString(props, INIT_PARAM_MISSING_AUTH_MAPPING, null); +// if (value != null) { +// initparams.put(INIT_PARAM_MISSING_AUTH_MAPPING, value); +// } + + try { + httpService.registerServlet(context, this, initparams, null); + + // set the contextPath field to signal successfull registration + this.contextPath = context; + + } catch (NamespaceException ne) { + // context collision + + } catch (ServletException se) { + // servlet initialization failure + + } + } + + protected void deactivate(ComponentContext context) { + if (contextPath != null) { + httpService.unregister(contextPath); + contextPath = null; + } + } + + // ---------- internal ----------------------------------------------------- + + private String getString(Dictionary props, String name, + String defaultValue) { + Object propValue = props.get(name); + return (propValue instanceof String) + ? (String) propValue + : defaultValue; + } +} Propchange: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java ------------------------------------------------------------------------------ svn:eol-style = native