public class HttpResourceConnection extends Object implements AutoCloseable
| Constructor and Description |
|---|
HttpResourceConnection(Settings settings)
Constructs a new HttpResourceConnection object.
|
HttpResourceConnection(Settings settings,
boolean usesProxy)
Constructs a new HttpResourceConnection object.
|
HttpResourceConnection(Settings settings,
boolean usesProxy,
String userKey,
String passwordKey)
Constructs a new HttpResourceConnection object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkForCommonExceptionTypes(IOException ex)
Analyzes the IOException, logs the appropriate information for debugging
purposes, and then throws a DownloadFailedException that wraps the IO
Exception for common IO Exceptions.
|
void |
close() |
InputStream |
fetch(URL url)
Retrieves the resource identified by the given URL and returns the
InputStream.
|
long |
getLastModified(URL url)
Deprecated.
this method is no longer used to check the last modified date
of the NVD. This method will be removed in a future release.
|
boolean |
isClosed()
Returns whether or not the connection has been closed.
|
public HttpResourceConnection(Settings settings)
settings - the configured settingspublic HttpResourceConnection(Settings settings, boolean usesProxy)
settings - the configured settingsusesProxy - control whether this conn will use the defined proxy.public HttpResourceConnection(Settings settings, boolean usesProxy, String userKey, String passwordKey)
settings - the configured settingsusesProxy - control whether this conn will use the defined proxyuserKey - the settings key for the username to be usedpasswordKey - the settings key for the password to be usedpublic InputStream fetch(URL url) throws DownloadFailedException, TooManyRequestsException, ResourceNotFoundException
url - the URL of the resource to downloadDownloadFailedException - is thrown
if there is an error downloading the resourceTooManyRequestsException - thrown when a 429 is receivedResourceNotFoundException - thrown when a 404 is received@Deprecated public long getLastModified(URL url) throws DownloadFailedException
url - the URL to retrieve the timestamp fromDownloadFailedException - is thrown
if an exception occurs making the HTTP requestpublic void close()
Releases the underlying HTTP URL Connection.
close in interface AutoCloseablepublic boolean isClosed()
public void checkForCommonExceptionTypes(IOException ex) throws DownloadFailedException
ex - the original exceptionDownloadFailedException - a wrapper
exception that contains the original exception as the causeCopyright © 2012–2020 OWASP. All rights reserved.