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;

I was tying to use the above snipped, but Eclipse is (obviously) not liking the unset logic due to the notNullbydefault… Should we just ignore this unsetHttpClientFactory one
**Bug** : Store of null value into field MiIoHandlerFactory.httpClient annotated @Nonnull in org.openhab.binding.miio.internal.MiIoHandlerFactory.unsetHttpClientFactory(HttpClientFactory)

@marcel_verpaalen I tried this and didn’t see any errors.

Developing my first binding and my device needs a PATCH, but it seems that org.eclipse.smarthome.io.net.http (or at least my version of it??) doesn’t support PATCH.

I searched through the currently being developed HTTP binding 2.x and it also uses org.eclipse.jetty.http.HttpMethod which doesn’t support PATCH. It’s also indicated in the description in the config:

            <parameter name="commandMethod" type="text">
				<label>Command Method</label>
				<description>HTTP method (GET,POST, PUT) for sending commands.</description>
					<option value="GET">GET</option>
					<option value="POST">POST</option>
					<option value="PUT">PUT</option>

Is the current state of PATCH that it’s still unavailable?