Search in sources :

Example 1 with HTMLException

use of com.biglybt.core.html.HTMLException in project BiglyBT by BiglySoftware.

the class ResourceDownloaderMetaRefreshImpl method getSizeSupport.

protected long getSizeSupport() throws ResourceDownloaderException {
    try {
        ResourceDownloader x = delegate.getClone(this);
        addReportListener(x);
        HTMLPage page = HTMLPageFactory.loadPage(x.download());
        URL base_url = (URL) x.getProperty("URL_URL");
        URL redirect = page.getMetaRefreshURL(base_url);
        if (redirect == null) {
            ResourceDownloaderBaseImpl c = delegate.getClone(this);
            addReportListener(c);
            long res = c.getSize();
            setProperties(c);
            return (res);
        } else {
            ResourceDownloaderURLImpl c = new ResourceDownloaderURLImpl(getParent(), redirect);
            addReportListener(c);
            long res = c.getSize();
            setProperties(c);
            return (res);
        }
    } catch (HTMLException e) {
        throw (new ResourceDownloaderException(this, "getSize failed", e));
    }
}
Also used : HTMLPage(com.biglybt.core.html.HTMLPage) ResourceDownloaderException(com.biglybt.pif.utils.resourcedownloader.ResourceDownloaderException) HTMLException(com.biglybt.core.html.HTMLException) ResourceDownloader(com.biglybt.pif.utils.resourcedownloader.ResourceDownloader) URL(java.net.URL)

Aggregations

HTMLException (com.biglybt.core.html.HTMLException)1 HTMLPage (com.biglybt.core.html.HTMLPage)1 ResourceDownloader (com.biglybt.pif.utils.resourcedownloader.ResourceDownloader)1 ResourceDownloaderException (com.biglybt.pif.utils.resourcedownloader.ResourceDownloaderException)1 URL (java.net.URL)1