incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r732658 - in /incubator/sling/trunk/jcr/webdav: ./ src/main/java/org/apache/sling/jcr/webdav/impl/helper/ src/main/java/org/apache/sling/jcr/webdav/impl/servlets/
Date Thu, 08 Jan 2009 09:22:50 GMT
Author: fmeschbe
Date: Thu Jan  8 01:22:49 2009
New Revision: 732658

URL: http://svn.apache.org/viewvc?rev=732658&view=rev
Log:
SLING-816 Use the MimeTypeService directly for MIME type
resolution instead of relying on the ServletContext service
registered by the SlingServlet

Modified:
    incubator/sling/trunk/jcr/webdav/pom.xml
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
    incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java

Modified: incubator/sling/trunk/jcr/webdav/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/pom.xml?rev=732658&r1=732657&r2=732658&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/pom.xml (original)
+++ incubator/sling/trunk/jcr/webdav/pom.xml Thu Jan  8 01:22:49 2009
@@ -108,6 +108,11 @@
             <artifactId>org.apache.sling.commons.osgi</artifactId>
             <version>2.0.3-incubator-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.mime</artifactId>
+            <version>2.0.2-incubator</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>

Modified: incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java?rev=732658&r1=732657&r2=732658&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
(original)
+++ incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingMimeResolver.java
Thu Jan  8 01:22:49 2009
@@ -14,21 +14,20 @@
  */
 package org.apache.sling.jcr.webdav.impl.helper;
 
-import javax.servlet.ServletContext;
-
 import org.apache.jackrabbit.server.io.MimeResolver;
+import org.apache.sling.commons.mime.MimeTypeService;
 
 public class SlingMimeResolver extends MimeResolver {
 
-    private final ServletContext servletContext;
+    private final MimeTypeService mimeTypeService;
     
-    public SlingMimeResolver(ServletContext servletContext) {
-        this.servletContext = servletContext;
+    public SlingMimeResolver(MimeTypeService mimeTypeService) {
+        this.mimeTypeService = mimeTypeService;
     }
 
     @Override
     public String getMimeType(String filename) {
-        String type = servletContext.getMimeType(filename);
+        String type = mimeTypeService.getMimeType(filename);
         if (type == null) {
             type = getDefaultMimeType();
         }

Modified: incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java?rev=732658&r1=732657&r2=732658&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
(original)
+++ incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
Thu Jan  8 01:22:49 2009
@@ -21,7 +21,6 @@
 import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
-import javax.servlet.ServletContext;
 
 import org.apache.jackrabbit.server.io.DefaultHandler;
 import org.apache.jackrabbit.server.io.DirListingExportHandler;
@@ -34,6 +33,7 @@
 import org.apache.jackrabbit.webdav.simple.ItemFilter;
 import org.apache.jackrabbit.webdav.simple.ResourceConfig;
 import org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet;
+import org.apache.sling.commons.mime.MimeTypeService;
 import org.apache.sling.commons.osgi.OsgiUtil;
 import org.apache.sling.jcr.webdav.impl.servlets.SlingWebDavServlet;
 
@@ -53,9 +53,9 @@
 
     private final Dictionary<String, String> servletInitParams;
 
-    public SlingResourceConfig(ServletContext servletContext,
+    public SlingResourceConfig(MimeTypeService mimetypService,
             Dictionary<?, ?> config) {
-        mimeResolver = new SlingMimeResolver(servletContext);
+        mimeResolver = new SlingMimeResolver(mimetypService);
         collectionTypes = OsgiUtil.toStringArray(
             config.get(SlingWebDavServlet.COLLECTION_TYPES),
             SlingWebDavServlet.COLLECTION_TYPES_DEFAULT);

Modified: incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java?rev=732658&r1=732657&r2=732658&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
(original)
+++ incubator/sling/trunk/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
Thu Jan  8 01:22:49 2009
@@ -21,12 +21,12 @@
 import javax.jcr.Repository;
 import javax.jcr.Session;
 import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
 import org.apache.jackrabbit.server.SessionProvider;
 import org.apache.jackrabbit.webdav.DavLocatorFactory;
 import org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet;
+import org.apache.sling.commons.mime.MimeTypeService;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.webdav.impl.helper.SlingLocatorFactory;
 import org.apache.sling.jcr.webdav.impl.helper.SlingResourceConfig;
@@ -103,7 +103,7 @@
     private HttpService httpService;
 
     /** @scr.reference */
-    private ServletContext servletContext;
+    private MimeTypeService mimeTypeService;
 
     private SlingResourceConfig resourceConfig;
 
@@ -169,7 +169,7 @@
     protected void activate(ComponentContext context)
             throws NamespaceException, ServletException {
 
-        resourceConfig = new SlingResourceConfig(servletContext,
+        resourceConfig = new SlingResourceConfig(mimeTypeService,
             context.getProperties());
 
         // Register servlet, and set the contextPath field to signal successful



Mime
View raw message