OH2 binding: accessing via HTTP - which library should be used?

Hello together,

is there a prefered way of HTTP based communication?

Whereas the org.apache.http.client.methods works fine within the eclipse IDE there seems to be trouble in the real life (on pi3) which can be avoided by using org.apache.commons.httpclient.methods combined with the appropriate lib included in the binding.

Any pointers appreciated & regards,

what about using eclipse smarthome httputil in


Thx. This one looks good to me.

It’s still valid ? Referring to smarthome docs seems must use jetty client… Which to use at this moment ?

It is using jetty, just giving you a simplified interface.

so better it or apache http util or what else ?

Use it, as it uses jetty. Please don’t use any other http util.

ok .thanks !

Like @hmerk mentioned the preferred method is to use org.eclipse.smarthome.io.net.http.HttpUtil.

If for some reason you really need a HttpClient for advanced usage you can get a HttpClient by injecting the HttpClientFactory in your service class:

    private @NonNullByDefault({}) HttpClient httpClient;


    protected void setHttpClientFactory(HttpClientFactory httpClientFactory) {
        this.httpClient = httpClientFactory.getCommonHttpClient();

    protected void unsetHttpClientFactory(HttpClientFactory httpClientFactory) {
        this.httpClient = null;