mirror of https://github.com/apache/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
This commit is contained in:
parent
1e78efcf9f
commit
a97d5c15b7
|
@ -132,11 +132,15 @@ public class ProxiedDavServer
|
||||||
public void process( DavServerRequest request, HttpServletResponse response )
|
public void process( DavServerRequest request, HttpServletResponse response )
|
||||||
throws DavServerException, ServletException, IOException
|
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 );
|
fetchContentFromProxies( request );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if ( isPut )
|
||||||
{
|
{
|
||||||
/* Create parent directories that don't exist when writing a file
|
/* Create parent directories that don't exist when writing a file
|
||||||
* This actually makes this implementation not compliant to the
|
* This actually makes this implementation not compliant to the
|
||||||
|
@ -153,6 +157,10 @@ public class ProxiedDavServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isGet )
|
||||||
|
{
|
||||||
|
if ( resourceExists( request ) )
|
||||||
|
{
|
||||||
// [MRM-503] - Metadata file need Pragma:no-cache response header.
|
// [MRM-503] - Metadata file need Pragma:no-cache response header.
|
||||||
if ( request.getLogicalResource().endsWith( "/maven-metadata.xml" ) )
|
if ( request.getLogicalResource().endsWith( "/maven-metadata.xml" ) )
|
||||||
{
|
{
|
||||||
|
@ -162,8 +170,6 @@ public class ProxiedDavServer
|
||||||
|
|
||||||
// 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
|
else
|
||||||
|
@ -172,6 +178,12 @@ public class ProxiedDavServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isPut )
|
||||||
|
{
|
||||||
|
davServer.process( request, response );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void respondResourceMissing( DavServerRequest request, HttpServletResponse response )
|
private void respondResourceMissing( DavServerRequest request, HttpServletResponse response )
|
||||||
{
|
{
|
||||||
response.setStatus( HttpServletResponse.SC_NOT_FOUND );
|
response.setStatus( HttpServletResponse.SC_NOT_FOUND );
|
||||||
|
|
Loading…
Reference in New Issue