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 TypeMethodDescriptionvoidaddProxyHandler(ProxyHandler proxyHandler) voidbuild()cache()voidclose()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 benullif the remote resource is unchanged.<T> TconnectWithProxy(ProxyHandler.ProxySetup proxySetup, Callable<T> r) findMatchingHandler(URL url) getCacheFileFor(URI url) getProxySetup(URL url) aQute.service.reporter.ReportergetUserFor(String base) booleanorg.osgi.util.promise.PromiseFactoryvoidreadSettings(Processor processor) voidreportSettings(Formatter out) retries(int retries) retryDelay(int retryDelay) <T> Tsend(HttpRequest<T> request) send0(HttpRequest<?> request) voidvoidvoidsetOffline(AtomicBoolean offline) voidsetRegistry(Registry registry) voidsetReporter(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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
connect
Description copied from interface:URLConnectorConnect to the specified URL.- Specified by:
connectin interfaceURLConnector- Parameters:
url-- Throws:
Exception
-
connectTagged
Description copied from interface:URLConnectorConnect to the specified URL, also returning the ETag if available.- Specified by:
connectTaggedin interfaceURLConnector- Parameters:
url- The remote URL.- Returns:
- An instance of
TaggedData; note that theTaggedData.getTag()method may returnnullif the resource has no tag. - Throws:
Exception
-
connectTagged
Description copied from interface:URLConnectorConnect to the specified URL while providing the last known tag for the remote resource; the response will benullif the remote resource is unchanged.- Specified by:
connectTaggedin interfaceURLConnector- Parameters:
url- The remote URL.tag- The last known tag value for the resource.- Returns:
- An instance of
TaggedData, ornullif the resource has not modified (i.e., if it has the same tag value). - Throws:
Exception
-
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:
MalformedURLExceptionException
-
toName
- Throws:
Exception
-
getCacheFileFor
- Throws:
Exception
-
readSettings
- Throws:
IOExceptionException
-
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
-