From d4c85abfac8d0920549f20735caf0e4028149c5c Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 1 Sep 2014 14:04:41 +1000 Subject: [PATCH] [MRM-1854] Last modified date is epoch on directory listing for a group --- .../webdav/ArchivaDavResourceFactory.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index 9d4b8ce92..375c4d83d 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -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 -- 2.39.5