in commons-transfer/commons-transfer-http/src/main/java/org/apache/archiva/commons/transfer/http/HttpTransferDownloader.java [165:214]
private Set<String> getHttpListing( URI absoluteURI, TransferFileFilter filter )
throws HttpException, IOException, TransferException
{
GetMethod getmethod = new GetMethod( absoluteURI.toASCIIString() );
try
{
getmethod.setFollowRedirects( true );
int status = client.executeMethod( getmethod );
if ( status != 200 )
{
triggerFailure( absoluteURI, status );
switch ( status )
{
case HttpStatus.SC_NOT_FOUND:
log.info( "Listing Not Found (404) for " + absoluteURI.toASCIIString() );
return Collections.emptySet();
case HttpStatus.SC_UNAUTHORIZED:
case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED:
throw new TransferAuthenticationRequiredException( HttpStatus.getStatusText( status ) + " - "
+ absoluteURI.toASCIIString() );
default:
throw new TransferException( "Error[" + status + ":" + HttpStatus.getStatusText( status )
+ "] " + absoluteURI.toASCIIString() );
}
}
InputStream input = null;
try
{
input = getmethod.getResponseBodyAsStream();
return linkParser.collectLinks( absoluteURI, input, filter );
}
catch ( SAXException e )
{
log.warn( "Unable to parse " + absoluteURI.toASCIIString() );
return Collections.emptySet();
}
finally
{
IOUtils.closeQuietly( input );
}
}
finally
{
getmethod.releaseConnection();
}
}