private Set getDavListing()

in commons-transfer/commons-transfer-http/src/main/java/org/apache/archiva/commons/transfer/http/HttpTransferDownloader.java [123:163]


    private Set<String> getDavListing( URI absoluteURI, TransferFileFilter filter )
        throws HttpException, IOException
    {
        PropFindMethod method = new PropFindMethod( absoluteURI );
        try
        {
            int status = client.executeMethod( method );
            if ( ( status == HttpStatus.SC_MULTI_STATUS ) || ( status == HttpStatus.SC_OK ) )
            {
                MultiStatus multistatus = method.getMultiStatus();
                Set<String> listing = new HashSet<String>();

                for ( DavResource resource : multistatus.getResources() )
                {
                    if ( resource.isCollection() )
                    {
                        continue;
                    }
                    String href = resource.getHref();

                    int idx = href.lastIndexOf( '/' );
                    if ( idx < 0 )
                    {
                        listing.add( href );
                    }
                    else
                    {
                        listing.add( href.substring( idx + 1 ) );
                    }
                }

                return listing;
            }

            return Collections.emptySet();
        }
        finally
        {
            method.releaseConnection();
        }
    }