public class HttpClient extends Object implements Closeable, URLConnector
Modifier and Type | Field and Description |
---|---|
static SimpleDateFormat |
sdf |
Constructor and Description |
---|
HttpClient() |
Modifier and Type | Method and Description |
---|---|
void |
addProxyHandler(ProxyHandler proxyHandler) |
void |
addURLConnectionHandler(URLConnectionHandler handler) |
HttpRequest<Object> |
build() |
void |
close() |
InputStream |
connect(URL url)
Connect to the specified URL.
|
TaggedData |
connectTagged(URL url)
Connect to the specified URL, also returning the ETag if available.
|
TaggedData |
connectTagged(URL url,
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,
Callable<T> r) |
URLConnectionHandler |
findMatchingHandler(URL url) |
File |
getCacheFileFor(URI url) |
ProxyHandler.ProxySetup |
getProxySetup(URL url) |
Reporter |
getReporter() |
String |
getUserFor(String base) |
boolean |
isOffline() |
URI |
makeDir(URI uri) |
void |
readSettings(Processor processor) |
Object |
send(HttpRequest<?> request) |
TaggedData |
send0(HttpRequest<?> request) |
void |
setCache(File cache) |
void |
setLog(File log) |
void |
setOffline(AtomicBoolean offline) |
void |
setRegistry(Registry registry) |
void |
setReporter(Reporter reporter) |
String |
toName(URI url) |
public static final SimpleDateFormat sdf
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public InputStream connect(URL url) throws Exception
URLConnector
connect
in interface URLConnector
IOException
Exception
public TaggedData connectTagged(URL url) throws Exception
URLConnector
connectTagged
in interface URLConnector
url
- The remote URL.TaggedData
; note that the
TaggedData.getTag()
method may return
null
if the resource has no tag.IOException
- @since 1.1Exception
public TaggedData connectTagged(URL url, String tag) throws Exception
URLConnector
null
if the remote resource
is unchanged.connectTagged
in interface URLConnector
url
- 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).IOException
- @since 1.1Exception
public HttpRequest<Object> build()
public Object send(HttpRequest<?> request) throws Exception
Exception
public TaggedData send0(HttpRequest<?> request) throws Exception
Exception
public ProxyHandler.ProxySetup getProxySetup(URL url) throws Exception
Exception
public <T> T connectWithProxy(ProxyHandler.ProxySetup proxySetup, Callable<T> r) throws Exception
Exception
public URLConnectionHandler findMatchingHandler(URL url) throws Exception
Exception
public void setCache(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(File log) throws IOException
IOException
public String getUserFor(String base) throws MalformedURLException, Exception
MalformedURLException
Exception
public void readSettings(Processor processor) throws IOException, Exception
IOException
Exception
public URI makeDir(URI uri) throws URISyntaxException
URISyntaxException
public boolean isOffline()
public void setOffline(AtomicBoolean offline)
Copyright © 2021 aQute SARL. All rights reserved.