Jersey 2: Use WebTarget.request() where necessary
When building a client request, the method WebTarget.request() must be used
to make a builder that provides the following methods:
- accept()
- header()
- method()
- get()
- post()
- put()
- delete()
Reference: https://jakartaee.github.io/rest/apidocs/2.1.6/javax/ws/rs/client/WebTarget.html#request()
diff --git a/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
index ce2f6ad..4d91607 100644
--- a/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
@@ -51,6 +51,7 @@
String pathUsername = "~" + username;
ClientResponse response = resource().path(API_VERSION)
.path(pathUsername).path("setting")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.type(MediaType.APPLICATION_JSON).entity(json)
@@ -61,6 +62,7 @@
// search
response = resource().path(API_VERSION).path("search")
.queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue(username, "pass"))
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/rewrite/QueryRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/QueryRewriteTest.java
index dd7e295..6f22b3a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/rewrite/QueryRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/QueryRewriteTest.java
@@ -26,6 +26,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]{%23examplequery} Baum")
.queryParam("ql", "poliqarp")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -41,6 +42,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]{%23system-q} Baum")
.queryParam("ql", "poliqarp")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -56,6 +58,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]{%23dory/dory-q} Baum")
.queryParam("ql", "poliqarp")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.get(ClientResponse.class);
diff --git a/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
index 4d2f684..f0b771e 100644
--- a/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
@@ -45,6 +45,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo named-vc1")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -70,6 +71,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"system/named-vc1\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -90,6 +92,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"system-vc\"")
+ .request()
.get(ClientResponse.class);
String ent = response.getEntity(String.class);
@@ -115,6 +118,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"system/system-vc\"")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("user", "pass"))
.header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -140,6 +144,7 @@
ClientResponse response = resource().path(API_VERSION).path("search")
.queryParam("q", "Fisch").queryParam("ql", "poliqarp")
.queryParam("cq", "referTo \"dory/dory-vc\"")
+ .request()
.header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
.createBasicAuthorizationHeaderValue("dory", "pass"))
.get(ClientResponse.class);