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
public abstract class AbstractURLHandler extends java.lang.Object implements URLHandler
-
-
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
Constructors Constructor Description AbstractURLHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetContentLength(java.net.URL url)Returns the length of the target if the given url is reachable, and without error code in case of http urls.longgetContentLength(java.net.URL url, int timeout)Returns the length of the target if the given url is reachable, and without error code in case of http urls.protected java.io.InputStreamgetDecodingInputStream(java.lang.String encoding, java.io.InputStream in)longgetLastModified(java.net.URL url)Please prefer getURLInfo when several infos are needed.longgetLastModified(java.net.URL url, int timeout)Please prefer getURLInfo when several infos are needed.intgetRequestMethod()protected java.lang.StringgetUserAgent()booleanisReachable(java.net.URL url)Please prefer getURLInfo when several infos are needed.booleanisReachable(java.net.URL url, int timeout)Please prefer getURLInfo when several infos are needed.protected java.lang.StringnormalizeToString(java.net.URL url)protected java.net.URLnormalizeToURL(java.net.URL url)voidsetRequestMethod(int requestMethod)protected voidvalidatePutStatusCode(java.net.URL dest, int statusCode, java.lang.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
-
-
-
-
Method Detail
-
isReachable
public boolean isReachable(java.net.URL url)
Description copied from interface:URLHandlerPlease prefer getURLInfo when several infos are needed.- Specified by:
isReachablein interfaceURLHandler- Parameters:
url- the url to check- Returns:
- true if the target is reachable
-
isReachable
public boolean isReachable(java.net.URL url, int timeout)Description copied from interface:URLHandlerPlease prefer getURLInfo when several infos are needed.- Specified by:
isReachablein interfaceURLHandler- Parameters:
url- the url to check- Returns:
- true if the target is reachable
-
getContentLength
public long getContentLength(java.net.URL url)
Description copied from interface:URLHandlerReturns the length of the target if the given url is reachable, and without error code in case of http urls. Please prefer getURLInfo when several infos are needed.- Specified by:
getContentLengthin interfaceURLHandler- Parameters:
url- the url to check- Returns:
- the length of the target if available, 0 if not reachable
-
getContentLength
public long getContentLength(java.net.URL url, int timeout)Description copied from interface:URLHandlerReturns the length of the target if the given url is reachable, and without error code in case of http urls.- Specified by:
getContentLengthin 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 available, 0 if not reachable
-
getLastModified
public long getLastModified(java.net.URL url)
Description copied from interface:URLHandlerPlease prefer getURLInfo when several infos are needed.- Specified by:
getLastModifiedin interfaceURLHandler- Parameters:
url- the url to check- Returns:
- last modified timestamp of the given url
-
getLastModified
public long getLastModified(java.net.URL url, int timeout)Description copied from interface:URLHandlerPlease prefer getURLInfo when several infos are needed.- Specified by:
getLastModifiedin interfaceURLHandler- Parameters:
url- the url to check- Returns:
- last modified timestamp of the given url
-
getUserAgent
protected java.lang.String getUserAgent()
-
validatePutStatusCode
protected void validatePutStatusCode(java.net.URL dest, int statusCode, java.lang.String statusMessage) throws java.io.IOException- Throws:
java.io.IOException
-
setRequestMethod
public void setRequestMethod(int requestMethod)
- Specified by:
setRequestMethodin interfaceURLHandler
-
getRequestMethod
public int getRequestMethod()
-
normalizeToString
protected java.lang.String normalizeToString(java.net.URL url) throws java.io.IOException- Throws:
java.io.IOException
-
normalizeToURL
protected java.net.URL normalizeToURL(java.net.URL url) throws java.io.IOException- Throws:
java.io.IOException
-
getDecodingInputStream
protected java.io.InputStream getDecodingInputStream(java.lang.String encoding, java.io.InputStream in) throws java.io.IOException- Throws:
java.io.IOException
-
-