public class HttpClient extends java.lang.Object implements java.io.Closeable, URLConnector
| Modifier and Type | Field and Description |
|---|---|
static java.text.SimpleDateFormat |
sdf |
| Constructor and Description |
|---|
HttpClient() |
| Modifier and Type | Method and Description |
|---|---|
void |
addProxyHandler(ProxyHandler proxyHandler) |
void |
addURLConnectionHandler(URLConnectionHandler handler) |
HttpRequest<java.lang.Object> |
build() |
void |
close() |
java.io.InputStream |
connect(java.net.URL url)
Connect to the specified URL.
|
TaggedData |
connectTagged(java.net.URL url)
Connect to the specified URL, also returning the ETag if available.
|
TaggedData |
connectTagged(java.net.URL url,
java.lang.String tag)
Connect to the specified URL while providing the last known tag for the
remote resource; the response will be
null if the remote resource
is unchanged. |
<T> T |
connectWithProxy(ProxyHandler.ProxySetup proxySetup,
java.util.concurrent.Callable<T> r) |
URLConnectionHandler |
findMatchingHandler(java.net.URL url) |
java.io.File |
getCacheFileFor(java.net.URI url) |
ProxyHandler.ProxySetup |
getProxySetup(java.net.URL url) |
Reporter |
getReporter() |
java.lang.String |
getUserFor(java.lang.String base) |
boolean |
isOffline() |
java.net.URI |
makeDir(java.net.URI uri) |
void |
readSettings(Processor processor) |
java.lang.Object |
send(HttpRequest<?> request) |
TaggedData |
send0(HttpRequest<?> request) |
void |
setCache(java.io.File cache) |
void |
setLog(java.io.File log) |
void |
setOffline(java.util.concurrent.atomic.AtomicBoolean offline) |
void |
setRegistry(Registry registry) |
void |
setReporter(Reporter reporter) |
java.lang.String |
toName(java.net.URI url) |
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic java.io.InputStream connect(java.net.URL url)
throws java.lang.Exception
URLConnectorconnect in interface URLConnectorjava.io.IOExceptionjava.lang.Exceptionpublic TaggedData connectTagged(java.net.URL url) throws java.lang.Exception
URLConnectorconnectTagged in interface URLConnectorurl - The remote URL.TaggedData; note that the
TaggedData.getTag() method may return
null if the resource has no tag.java.io.IOException - @since 1.1java.lang.Exceptionpublic TaggedData connectTagged(java.net.URL url, java.lang.String tag) throws java.lang.Exception
URLConnectornull if the remote resource
is unchanged.connectTagged in interface URLConnectorurl - The remote URL.tag - The last known tag value for the resource.TaggedData, or null if the
resource has not modified (i.e., if it has the same tag value).java.io.IOException - @since 1.1java.lang.Exceptionpublic HttpRequest<java.lang.Object> build()
public java.lang.Object send(HttpRequest<?> request) throws java.lang.Exception
java.lang.Exceptionpublic TaggedData send0(HttpRequest<?> request) throws java.lang.Exception
java.lang.Exceptionpublic ProxyHandler.ProxySetup getProxySetup(java.net.URL url) throws java.lang.Exception
java.lang.Exceptionpublic <T> T connectWithProxy(ProxyHandler.ProxySetup proxySetup, java.util.concurrent.Callable<T> r) throws java.lang.Exception
java.lang.Exceptionpublic URLConnectionHandler findMatchingHandler(java.net.URL url) throws java.lang.Exception
java.lang.Exceptionpublic void setCache(java.io.File cache)
public void setReporter(Reporter reporter)
public void setRegistry(Registry registry)
public void addURLConnectionHandler(URLConnectionHandler handler)
public Reporter getReporter()
public void addProxyHandler(ProxyHandler proxyHandler)
public void setLog(java.io.File log)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getUserFor(java.lang.String base)
throws java.net.MalformedURLException,
java.lang.Exception
java.net.MalformedURLExceptionjava.lang.Exceptionpublic java.lang.String toName(java.net.URI url)
throws java.lang.Exception
java.lang.Exceptionpublic java.io.File getCacheFileFor(java.net.URI url)
throws java.lang.Exception
java.lang.Exceptionpublic void readSettings(Processor processor) throws java.io.IOException, java.lang.Exception
java.io.IOExceptionjava.lang.Exceptionpublic java.net.URI makeDir(java.net.URI uri)
throws java.net.URISyntaxException
java.net.URISyntaxExceptionpublic boolean isOffline()
public void setOffline(java.util.concurrent.atomic.AtomicBoolean offline)
Copyright (c) aQute SARL (2000, 2017) and others. All Rights Reserved.