From: Joakim Erdfelt Date: Tue, 16 Oct 2007 01:29:31 +0000 (+0000) Subject: Fixing GET vs PUT logic. X-Git-Tag: archiva-1.0-beta-3~78 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a97d5c15b713f69ba6928cc89229b84969e355e0;p=archiva.git Fixing GET vs PUT logic. Encountered a situation where a PUT could result in a 404. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@584992 13f79535-47bb-0310-9956-ffa450edef68 --- 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 07b58c5bb..cfa63a093 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 @@ -132,11 +132,15 @@ public class ProxiedDavServer public void process( DavServerRequest request, HttpServletResponse response ) throws DavServerException, ServletException, IOException { - if ( WebdavMethodUtil.isReadMethod( request.getRequest().getMethod() ) ) + boolean isGet = WebdavMethodUtil.isReadMethod( request.getRequest().getMethod() ); + boolean isPut = WebdavMethodUtil.isWriteMethod( request.getRequest().getMethod() ); + + if ( isGet ) { fetchContentFromProxies( request ); } - else + + if ( isPut ) { /* Create parent directories that don't exist when writing a file * This actually makes this implementation not compliant to the @@ -153,22 +157,30 @@ public class ProxiedDavServer } } - // [MRM-503] - Metadata file need Pragma:no-cache response header. - if ( request.getLogicalResource().endsWith( "/maven-metadata.xml" ) ) + if ( isGet ) { - response.addHeader( "Pragma", "no-cache" ); - response.addHeader( "Cache-Control", "no-cache" ); - } + if ( resourceExists( request ) ) + { + // [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: [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) - if( resourceExists( request ) ) - { - davServer.process( request, response ); + davServer.process( request, response ); + } + else + { + respondResourceMissing( request, response ); + } } - else + + if ( isPut ) { - respondResourceMissing( request, response ); + davServer.process( request, response ); } }