org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader
Class ResourceDownloaderURLImpl

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
      extended by org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderURLImpl
All Implemented Interfaces:
SEPasswordListener, ResourceDownloader

public class ResourceDownloaderURLImpl
extends ResourceDownloaderBaseImpl
implements SEPasswordListener


Field Summary
 
Fields inherited from class org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
this_mon
 
Fields inherited from interface org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloader
PR_BOOLEAN_ANONYMOUS, PR_STRING_CONTENT_TYPE
 
Constructor Summary
ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent, java.net.URL _url)
           
ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent, java.net.URL _url, boolean _auth_supplied, java.lang.String _user_name, java.lang.String _password)
           
ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent, java.net.URL _url, byte[] _data, boolean _auth_supplied, java.lang.String _user_name, java.lang.String _password)
           
ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent, java.net.URL _url, java.lang.String _user_name, java.lang.String _password)
           
 
Method Summary
 void asyncDownload()
          Asynchronously download.
 void cancel()
          Cancel the download.
 void clearPasswords()
           
 java.io.InputStream download()
          Synchronously download.
 java.net.PasswordAuthentication getAuthentication(java.lang.String realm, java.net.URL tracker)
           
 ResourceDownloaderBaseImpl getClone(ResourceDownloaderBaseImpl parent)
           
 java.lang.String getName()
          Get a sensible name for the download based on its details (e.g.
protected  void getRequestProperties(java.net.URLConnection con)
           
 long getSize()
          Attempts to get the size of the download.
protected  long getSizeSupport()
           
protected  java.net.URL getURL()
           
 void setAuthenticationOutcome(java.lang.String realm, java.net.URL tracker, boolean success)
           
protected  void setAutoPluginProxy()
           
protected  void setForceNoProxy(boolean force_no_proxy)
           
protected  void setForceProxy(java.net.Proxy proxy)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
protected  void setRequestProperties(java.net.URLConnection con, boolean use_compression)
           
protected  void setSize(long l)
           
protected  java.lang.String trimForDisplay(java.net.URL url)
           
 
Methods inherited from class org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderBaseImpl
addChild, addListener, addReportListener, getBooleanProperty, getBooleanProperty, getChildren, getClone, getLCKeyProperties, getLogIndent, getLongProperty, getParent, getProperty, getProperty, getPropertySupport, getStringProperty, getStringPropertySupport, informActivity, informAmountComplete, informComplete, informFailed, informPercentDone, isAnonymous, isCancelled, removeChild, removeListener, reportActivity, reportActivity, reportAmountComplete, reportPercentComplete, setCancelled, setParent, setProperties, setPropertiesSet, setPropertyRecursive, setPropertySupport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceDownloaderURLImpl

public ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent,
                                 java.net.URL _url)

ResourceDownloaderURLImpl

public ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent,
                                 java.net.URL _url,
                                 java.lang.String _user_name,
                                 java.lang.String _password)

ResourceDownloaderURLImpl

public ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent,
                                 java.net.URL _url,
                                 boolean _auth_supplied,
                                 java.lang.String _user_name,
                                 java.lang.String _password)

ResourceDownloaderURLImpl

public ResourceDownloaderURLImpl(ResourceDownloaderBaseImpl _parent,
                                 java.net.URL _url,
                                 byte[] _data,
                                 boolean _auth_supplied,
                                 java.lang.String _user_name,
                                 java.lang.String _password)
Parameters:
_parent -
_url -
_data - if null, GET will be used, otherwise POST will be used with the data supplied
_auth_supplied -
_user_name -
_password -
Method Detail

setForceNoProxy

protected void setForceNoProxy(boolean force_no_proxy)

setForceProxy

protected void setForceProxy(java.net.Proxy proxy)

setAutoPluginProxy

protected void setAutoPluginProxy()

getURL

protected java.net.URL getURL()

getName

public java.lang.String getName()
Description copied from interface: ResourceDownloader
Get a sensible name for the download based on its details (e.g. URL)

Specified by:
getName in interface ResourceDownloader
Returns:

getSize

public long getSize()
             throws ResourceDownloaderException
Description copied from interface: ResourceDownloader
Attempts to get the size of the download. Returns -1 if the size can't be determined.

Note: You must not call this method from the reportActivity callback method.

Specified by:
getSize in interface ResourceDownloader
Throws:
ResourceDownloaderException

setSize

protected void setSize(long l)
Specified by:
setSize in class ResourceDownloaderBaseImpl

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws ResourceDownloaderException
Specified by:
setProperty in interface ResourceDownloader
Throws:
ResourceDownloaderException

getSizeSupport

protected long getSizeSupport()
                       throws ResourceDownloaderException
Throws:
ResourceDownloaderException

getClone

public ResourceDownloaderBaseImpl getClone(ResourceDownloaderBaseImpl parent)
Specified by:
getClone in class ResourceDownloaderBaseImpl

asyncDownload

public void asyncDownload()
Description copied from interface: ResourceDownloader
Asynchronously download.

Specified by:
asyncDownload in interface ResourceDownloader

download

public java.io.InputStream download()
                             throws ResourceDownloaderException
Description copied from interface: ResourceDownloader
Synchronously download. Events are still reported to listeners

Specified by:
download in interface ResourceDownloader
Returns:
Throws:
ResourceDownloaderException

cancel

public void cancel()
Description copied from interface: ResourceDownloader
Cancel the download.

Specified by:
cancel in interface ResourceDownloader

setRequestProperties

protected void setRequestProperties(java.net.URLConnection con,
                                    boolean use_compression)

getRequestProperties

protected void getRequestProperties(java.net.URLConnection con)

getAuthentication

public java.net.PasswordAuthentication getAuthentication(java.lang.String realm,
                                                         java.net.URL tracker)
Specified by:
getAuthentication in interface SEPasswordListener

setAuthenticationOutcome

public void setAuthenticationOutcome(java.lang.String realm,
                                     java.net.URL tracker,
                                     boolean success)
Specified by:
setAuthenticationOutcome in interface SEPasswordListener

clearPasswords

public void clearPasswords()
Specified by:
clearPasswords in interface SEPasswordListener

trimForDisplay

protected java.lang.String trimForDisplay(java.net.URL url)