Search in sources :

Example 1 with ExternalResourceReadResponse

use of org.gradle.internal.resource.transfer.ExternalResourceReadResponse in project gradle by gradle.

the class HttpResourceLister method list.

public List<String> list(final URI directory) {
    final ExternalResourceReadResponse response = accessor.openResource(directory, true);
    if (response == null) {
        return null;
    }
    try {
        try {
            String contentType = response.getMetaData().getContentType();
            ApacheDirectoryListingParser directoryListingParser = new ApacheDirectoryListingParser();
            InputStream inputStream = response.openStream();
            try {
                return directoryListingParser.parse(directory, inputStream, contentType);
            } catch (Exception e) {
                throw new ResourceException(directory, String.format("Unable to parse HTTP directory listing for '%s'.", directory), e);
            }
        } finally {
            response.close();
        }
    } catch (IOException e) {
        throw ResourceExceptions.getFailed(directory, e);
    }
}
Also used : InputStream(java.io.InputStream) ResourceException(org.gradle.api.resources.ResourceException) ExternalResourceReadResponse(org.gradle.internal.resource.transfer.ExternalResourceReadResponse) IOException(java.io.IOException) ResourceException(org.gradle.api.resources.ResourceException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ResourceException (org.gradle.api.resources.ResourceException)1 ExternalResourceReadResponse (org.gradle.internal.resource.transfer.ExternalResourceReadResponse)1