Package aQute.bnd.http
Class HttpClient
java.lang.Object
aQute.bnd.http.HttpClient
- All Implemented Interfaces:
URLConnector
,Closeable
,AutoCloseable
A simple Http Client that inter-works with the bnd registry. It provides an
easy way to construct a URL request. The request is then decorated with third
parties that are in the bnd registry for proxies and authentication models.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProxyHandler
(ProxyHandler proxyHandler) void
build()
cache()
void
close()
Connect to the specified URL.connectTagged
(URL url) Connect to the specified URL, also returning the ETag if available.connectTagged
(URL url, String tag) Connect to the specified URL while providing the last known tag for the remote resource; the response will benull
if the remote resource is unchanged.<T> T
connectWithProxy
(ProxyHandler.ProxySetup proxySetup, Callable<T> r) findMatchingHandler
(URL url) getCacheFileFor
(URI url) getProxySetup
(URL url) aQute.service.reporter.Reporter
getUserFor
(String base) boolean
org.osgi.util.promise.PromiseFactory
void
readSettings
(Processor processor) void
reportSettings
(Formatter out) retries
(int retries) retryDelay
(int retryDelay) <T> T
send
(HttpRequest<T> request) send0
(HttpRequest<?> request) void
void
void
setOffline
(AtomicBoolean offline) void
setRegistry
(Registry registry) void
setReporter
(aQute.service.reporter.Reporter reporter) validateURI
(URI u) Validate a URI to see if it is supported by this client
-
Field Details
-
sdf
Deprecated.
-
-
Constructor Details
-
HttpClient
public HttpClient()
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
connect
Description copied from interface:URLConnector
Connect to the specified URL.- Specified by:
connect
in interfaceURLConnector
- Throws:
IOException
Exception
-
connectTagged
Description copied from interface:URLConnector
Connect to the specified URL, also returning the ETag if available.- Specified by:
connectTagged
in interfaceURLConnector
- Parameters:
url
- The remote URL.- Returns:
- An instance of
TaggedData
; note that theTaggedData.getTag()
method may returnnull
if the resource has no tag. - Throws:
IOException
- @since 1.1Exception
-
connectTagged
Description copied from interface:URLConnector
Connect to the specified URL while providing the last known tag for the remote resource; the response will benull
if the remote resource is unchanged.- Specified by:
connectTagged
in interfaceURLConnector
- Parameters:
url
- The remote URL.tag
- The last known tag value for the resource.- Returns:
- An instance of
TaggedData
, ornull
if the resource has not modified (i.e., if it has the same tag value). - Throws:
IOException
- @since 1.1Exception
-
build
-
send
- Throws:
Exception
-
send0
- Throws:
Exception
-
getProxySetup
- Throws:
Exception
-
connectWithProxy
- Throws:
Exception
-
findMatchingHandler
-
setCache
-
setReporter
public void setReporter(aQute.service.reporter.Reporter reporter) -
setRegistry
-
addURLConnectionHandler
-
getReporter
public aQute.service.reporter.Reporter getReporter() -
addProxyHandler
-
setLog
- Throws:
IOException
-
getUserFor
- Throws:
MalformedURLException
Exception
-
toName
- Throws:
Exception
-
getCacheFileFor
- Throws:
Exception
-
readSettings
- Throws:
IOException
Exception
-
makeDir
- Throws:
URISyntaxException
-
isOffline
public boolean isOffline() -
setOffline
-
promiseFactory
public org.osgi.util.promise.PromiseFactory promiseFactory() -
cache
-
reportSettings
-
retries
-
retryDelay
-
validateURI
Validate a URI to see if it is supported by this client- Parameters:
u
- the uri- Returns:
- null if ok, otherwise a reason why it is invalid
-