ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maarten Coene <maarten_co...@yahoo.com>
Subject Re: URLResolver's dependency on URLConnection.getContentLength()
Date Mon, 24 Nov 2008 22:49:28 GMT
I don't know if it will be easy to support such a thing because the URLInfo.getContentLength()
might be used in different places.
We should investigate this further to see if Ivy could deal with an unknown content-length.
Could you create a JIRA ticket?

Maarten



----- Original Message ----
From: Jeffrey Sinclair <jeff@cooljeff.co.uk>
To: ivy-user@ant.apache.org
Sent: Monday, November 24, 2008 11:14:20 PM
Subject: URLResolver's dependency on URLConnection.getContentLength()

I've been trying to use the URLResolver with a custom protocol that
returns -1 for URLConnection.getContentLength(). The problem I'm seeing
is that for my custom protocol, resources can never be found.

After a little debugging I found the following code in
org.apache.ivy.util.url.BasicURLHandler.getURLInfo() which explains why
I'm running into issues:


    public URLInfo getURLInfo(URL url, int timeout) {

...
            if (con instanceof HttpURLConnection) {
               ...
            } else {

                int contentLength = con.getContentLength();

                if (contentLength <= 0) {

                    return UNAVAILABLE;

                } else {

                   ...
                }

            }

        } 

Is this a bug in the URLResolver? For certain resources which are
streamed, the content length will not be known so I'm not sure that
UNAVAILABLE should be dependent on the content length.

Regards,

Jeff


      

Mime
View raw message