From dca8107e77882150e8d162fbb78c0f9fc3cbb919 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 26 Sep 2007 18:23:41 +0000 Subject: [PATCH] [MRM-503] Metadata files need Pragma:no-cache response header. Applied Pragma and Cache-Control headers to maven-metadata.xml requests only. Added TODO for other filetypes. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@579747 13f79535-47bb-0310-9956-ffa450edef68 --- .../web/repository/ProxiedDavServer.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java index 5619173a6..0233e3d71 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java @@ -146,12 +146,14 @@ public class ProxiedDavServer } else { - // Create parent directories that don't exist when writing a file - // This actually makes this implementation not compliant to the - // WebDAV RFC - but we have enough knowledge - // about how the collection is being used to do this reasonably and - // some versions of Maven's WebDAV don't - // correctly create the collections themselves. + /* Create parent directories that don't exist when writing a file + * This actually makes this implementation not compliant to the + * WebDAV RFC - but we have enough knowledge + * about how the collection is being used to do this reasonably and + * some versions of Maven's WebDAV don't + * correctly create the collections themselves. + */ + File rootDirectory = getRootDirectory(); if ( rootDirectory != null ) { @@ -159,6 +161,15 @@ public class ProxiedDavServer } } + // MRM-503 - Metadata file need Pragma:no-cache response header. + if ( request.getLogicalResource().endsWith( "/maven-metadata.xml" ) ) + { + response.addHeader( "Pragma", "no-cache" ); + response.addHeader( "Cache-Control", "no-cache" ); + } + + // TODO: determine http caching options for other types of files (artifacts, sha1, md5, snapshots) + davServer.process( request, response ); } -- 2.39.5