Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import de.geeksfactory.opacclient.apis.VuFind;
import de.geeksfactory.opacclient.apis.WebOpacNet;
import de.geeksfactory.opacclient.apis.WinBiap;
import de.geeksfactory.opacclient.apis.Wise;
import de.geeksfactory.opacclient.apis.Zones;
import de.geeksfactory.opacclient.i18n.DummyStringProvider;
import de.geeksfactory.opacclient.i18n.StringProvider;
Expand Down Expand Up @@ -166,6 +167,8 @@ public static OpacApi create(Library lib, StringProvider sp, HttpClientFactory h
newApiInstance = new BIB2();
} else if (lib.getApi().equals("test")) {
newApiInstance = new TestApi();
} else if (lib.getApi().equals("wise")) {
newApiInstance = new Wise();
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java8.util.concurrent.CompletableFuture;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand All @@ -30,6 +31,7 @@ public abstract class OkHttpBaseApi extends BaseApi {
public OkHttpClient http_client;
public HttpClientFactory http_client_factory;
protected boolean httpLoggingEnabled = true;
public Interceptor http_interceptor;

/**
* Initializes HTTP client and String Provider
Expand All @@ -40,7 +42,9 @@ public void init(Library library, HttpClientFactory http_client_factory, boolean
http_client = http_client_factory.getNewOkHttpClient(
library.getData().optBoolean("customssl", false),
library.getData().optBoolean("customssl_tls_only", true),
library.getData().optBoolean("customssl_all_ciphersuites", false)
library.getData().optBoolean("customssl_all_ciphersuites", false),
false,
http_interceptor
);
http_client.dispatcher().setMaxRequestsPerHost(10);
this.library = library;
Expand Down Expand Up @@ -363,6 +367,17 @@ public String httpPost(String url, RequestBody data)
return httpPost(url, data, getDefaultEncoding(), false);
}

public void httpDelete(String url) throws IOException {
Request.Builder requestbuilder = new Request.Builder()
.url(cleanUrl(url))
.header("Accept", "*/*")
.header("User-Agent", getUserAgent());

Request request = requestbuilder.delete().build();

Response response = http_client.newCall(request).execute();
}

public void setHttpLoggingEnabled(boolean httpLoggingEnabled) {
this.httpLoggingEnabled = httpLoggingEnabled;
}
Expand Down
Loading