Author: joakime
Date: Mon Oct 15 18:29:31 2007
New Revision: 584992

URL: http://svn.apache.org/viewvc?rev=584992&view=rev
Log:
Fixing GET vs PUT logic.
Encountered a situation where a PUT could result in a 404.


Modified:
    
maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java

Modified: 
maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java
URL: 
http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java?rev=584992&r1=584991&r2=584992&view=diff
==============================================================================
--- 
maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java
 (original)
+++ 
maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java
 Mon Oct 15 18:29:31 2007
@@ -132,11 +132,15 @@
     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 @@
             }
         }
 
-        // [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 );
         }
     }
 


Reply via email to