prevent caching when browsing a directory

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1388705 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-21 22:13:53 +00:00
parent 8c8f3a21ea
commit 9e37277c4a
1 changed files with 17 additions and 8 deletions

View File

@ -852,10 +852,19 @@ public class ArchivaDavResourceFactory
response.setHeader( "Pragma", "no-cache" ); response.setHeader( "Pragma", "no-cache" );
response.setHeader( "Cache-Control", "no-cache" ); response.setHeader( "Cache-Control", "no-cache" );
} }
// if the resource is a directory don't cache it as new groupId deployed will be available
// without need of refreshing browser
if ( ( (ArchivaDavResource) resource ).getLocalResource().isDirectory() )
{
response.setHeader( "Pragma", "no-cache" );
response.setHeader( "Cache-Control", "no-cache" );
response.setDateHeader( "last-modified", new Date().getTime() );
}
else
{
// We need to specify this so connecting wagons can work correctly // We need to specify this so connecting wagons can work correctly
response.setDateHeader( "last-modified", resource.getModificationTime() ); response.setDateHeader( "last-modified", resource.getModificationTime() );
}
// TODO: [MRM-524] determine http caching options for other types of files (artifacts, sha1, md5, snapshots) // TODO: [MRM-524] determine http caching options for other types of files (artifacts, sha1, md5, snapshots)
} }