}
else
{
- setHeaders( locator, response );
+ setHeaders(response, locator, resource );
// compatibility with MRM-440 to ensure browsing the repository works ok
if ( resource.isCollection() && !request.getRequestURI().endsWith("/" ) )
this.auditListeners.remove( listener );
}
- private void setHeaders( DavResourceLocator locator, DavServletResponse response )
+ private void setHeaders( DavServletResponse response, DavResourceLocator locator, DavResource resource )
{
// [MRM-503] - Metadata file need Pragma:no-cache response
// header.
response.addHeader( "Cache-Control", "no-cache" );
}
+ //We need to specify this so connecting wagons can work correctly
+ response.addDateHeader("last-modified", resource.getModificationTime());
+
// TODO: [MRM-524] determine http caching options for other types of files (artifacts, sha1, md5, snapshots)
}
public class RepositoryServletNoProxyTest
extends AbstractRepositoryServletTestCase
{
+ public void testLastModifiedHeaderExists()
+ throws Exception
+ {
+ String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
+
+ File checksumFile = new File( repoRootInternal, commonsLangSha1 );
+ checksumFile.getParentFile().mkdirs();
+
+ FileUtils.writeStringToFile( checksumFile, "dummy-checksum", null );
+
+ WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangSha1 );
+ WebResponse response = sc.getResponse( request );
+
+ assertNotNull(response.getHeaderField("last-modified"));
+ }
+
public void testGetNoProxyChecksumDefaultLayout()
throws Exception
{