]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1854] Last modified date is epoch on directory listing for a group
authorOlivier Lamy <olamy@apache.org>
Mon, 1 Sep 2014 04:04:41 +0000 (14:04 +1000)
committerOlivier Lamy <olamy@apache.org>
Mon, 1 Sep 2014 04:04:41 +0000 (14:04 +1000)
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java

index 9d4b8ce92f01f2b2d8c90b7386319aaaf078a845..375c4d83dfe57705fa797186a32983ae748686aa 100644 (file)
@@ -244,7 +244,7 @@ public class ArchivaDavResourceFactory
                         getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator,
                                               repoGroupConfig );
 
-                    setHeaders( response, locator, davResource );
+                    setHeaders( response, locator, davResource, true );
 
                     return davResource;
 
@@ -291,7 +291,7 @@ public class ArchivaDavResourceFactory
                                                        auditListeners, //
                                                        scheduler, //
                                                        fileLockManager );
-                    setHeaders( response, locator, resource );
+                    setHeaders( response, locator, resource, false );
                     return resource;
                 }
             }
@@ -432,7 +432,7 @@ public class ArchivaDavResourceFactory
             }
         }
 
-        setHeaders( response, locator, resource );
+        setHeaders( response, locator, resource, false );
 
         // compatibility with MRM-440 to ensure browsing the repository works ok
         if ( resource.isCollection() && !request.getRequestURI().endsWith( "/" ) )
@@ -873,7 +873,8 @@ public class ArchivaDavResourceFactory
         this.auditListeners.remove( listener );
     }
 
-    private void setHeaders( DavServletResponse response, DavResourceLocator locator, DavResource resource )
+    private void setHeaders( DavServletResponse response, DavResourceLocator locator, DavResource resource,
+                             boolean group )
     {
         // [MRM-503] - Metadata file need Pragma:no-cache response
         // header.
@@ -894,6 +895,14 @@ public class ArchivaDavResourceFactory
             response.setHeader( "Cache-Control", "no-cache" );
             response.setDateHeader( "Last-Modified", new Date().getTime() );
         }
+        else if ( group )
+        {
+            if ( resource instanceof ArchivaVirtualDavResource )
+            {
+                //MRM-1854 here we have a directory so force "Last-Modified"
+                response.setDateHeader( "Last-Modified", new Date().getTime() );
+            }
+        }
         else
         {
             // We need to specify this so connecting wagons can work correctly