Package org.apache.ivy.util.url
Class AbstractURLHandler
java.lang.Object
org.apache.ivy.util.url.AbstractURLHandler
- All Implemented Interfaces:
URLHandler
- Direct Known Subclasses:
BasicURLHandler
,HttpClientHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.ivy.util.url.URLHandler
URLHandler.URLInfo
-
Field Summary
Fields inherited from interface org.apache.ivy.util.url.URLHandler
REQUEST_METHOD_GET, REQUEST_METHOD_HEAD, UNAVAILABLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static TimeoutConstraint
createTimeoutConstraints
(int connectionTimeout) long
getContentLength
(URL url) Please prefer getURLInfo when several infos are needed.long
getContentLength
(URL url, int timeout) protected InputStream
getDecodingInputStream
(String encoding, InputStream in) long
getLastModified
(URL url) Please prefer getURLInfo when several infos are needed.long
getLastModified
(URL url, int timeout) Please prefer getURLInfo when several infos are needed.int
protected String
boolean
isReachable
(URL url) Please prefer getURLInfo when several infos are needed.boolean
isReachable
(URL url, int timeout) Please prefer getURLInfo when several infos are needed.protected String
normalizeToString
(URL url) protected URL
normalizeToURL
(URL url) void
setRequestMethod
(int requestMethod) protected void
validatePutStatusCode
(URL dest, int statusCode, String statusMessage) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.ivy.util.url.URLHandler
download, getURLInfo, getURLInfo, openStream, upload
-
Constructor Details
-
AbstractURLHandler
public AbstractURLHandler()
-
-
Method Details
-
isReachable
Description copied from interface:URLHandler
Please prefer getURLInfo when several infos are needed.- Specified by:
isReachable
in interfaceURLHandler
- Parameters:
url
- the url to check- Returns:
- true if the target is reachable
-
isReachable
Description copied from interface:URLHandler
Please prefer getURLInfo when several infos are needed.- Specified by:
isReachable
in interfaceURLHandler
- Parameters:
url
- the url to checktimeout
- the timeout in milliseconds- Returns:
- true if the target is reachable
-
getContentLength
Description copied from interface:URLHandler
Please prefer getURLInfo when several infos are needed.- Specified by:
getContentLength
in interfaceURLHandler
- Parameters:
url
- the url to check- Returns:
- the length of the target if the given url is reachable, 0 otherwise. No error code in case of http urls.
-
getContentLength
- Specified by:
getContentLength
in interfaceURLHandler
- Parameters:
url
- the url to checktimeout
- the maximum time before considering an url is not reachable a timeout of zero indicates no timeout- Returns:
- the length of the target if the given url is reachable, 0 otherwise. No error code in case of http urls.
-
getLastModified
Description copied from interface:URLHandler
Please prefer getURLInfo when several infos are needed.- Specified by:
getLastModified
in interfaceURLHandler
- Parameters:
url
- the url to check- Returns:
- last modified timestamp of the given url
-
getLastModified
Description copied from interface:URLHandler
Please prefer getURLInfo when several infos are needed.- Specified by:
getLastModified
in interfaceURLHandler
- Parameters:
url
- the url to checktimeout
- the timeout in milliseconds- Returns:
- last modified timestamp of the given url
-
getUserAgent
-
validatePutStatusCode
protected void validatePutStatusCode(URL dest, int statusCode, String statusMessage) throws IOException - Throws:
IOException
-
setRequestMethod
public void setRequestMethod(int requestMethod) - Specified by:
setRequestMethod
in interfaceURLHandler
-
getRequestMethod
public int getRequestMethod() -
normalizeToString
- Throws:
IOException
-
normalizeToURL
- Throws:
IOException
-
getDecodingInputStream
- Throws:
IOException
-
createTimeoutConstraints
-