Jersey 2: Migrate requests made in unittests

This commit is a set of simple migrations for client requests made in
unittests.

The javax.ws.rs.core.Response class is the default object returned by
the request methods: get, post, put, and delete; This class can be a replacement
for com.sun.jersey.api.client.ClientResponse from Jersey 1.x.

Why not use org.glassfish.jersey.client.ClientResponse as a replacement instead?
When trying to return a org.glassfish.jersey.client.ClientResponse from the
request methods, the Jersey implementation for some reason attempts to use
the Jackson ObjectMapper to convert the do the conversion which by default will fail
with an exception.

Other simple migrations in this commit include replacing MultivaluedMap with
javax.ws.rs.core.Form for form query parameters; And conforming to the new signature
for put() and post() methods a javax.ws.rs.client.Entity is always supplied.
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/InfoControllerTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/InfoControllerTest.java
index ded6871..9a1df6a 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/InfoControllerTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/InfoControllerTest.java
@@ -6,8 +6,9 @@
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.config.LiteJerseyTest;
@@ -26,13 +27,13 @@
     
     @Test
     public void testInfo () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("info")
+        Response response = target().path(API_VERSION).path("info")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(config.getCurrentVersion(),
                 node.at("/latest_api_version").asText());
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteMultipleCorpusQueryTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteMultipleCorpusQueryTest.java
index 0b253e4..0ae5fb1 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteMultipleCorpusQueryTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteMultipleCorpusQueryTest.java
@@ -7,9 +7,11 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.UniformInterfaceException;
 
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
 import de.ids_mannheim.korap.config.LiteJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
@@ -19,15 +21,15 @@
 
     @Test
     public void testSearchGet () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "das").queryParam("ql", "poliqarp")
                 .queryParam("cq", "pubPlace=München")
                 .queryParam("cq", "textSigle=\"GOE/AGA/01784\"")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         node = node.at("/collection");
         assertEquals("koral:docGroup", node.at("/@type").asText());
@@ -45,14 +47,14 @@
     public void testStatisticsWithMultipleCq ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("statistics")
+        Response response = target().path(API_VERSION).path("statistics")
                 .queryParam("cq", "textType=Abhandlung")
                 .queryParam("cq", "corpusSigle=GOE")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.at("/documents").asInt());
         assertEquals(138180, node.at("/tokens").asInt());
@@ -66,14 +68,14 @@
     public void testStatisticsWithMultipleCorpusQuery ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("statistics")
+        Response response = target().path(API_VERSION).path("statistics")
                 .queryParam("corpusQuery", "textType=Autobiographie")
                 .queryParam("corpusQuery", "corpusSigle=GOE")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(9, node.at("/documents").asInt());
         assertEquals(527662, node.at("/tokens").asInt());
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java
index c1b14a1..9378ed8 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchControllerTest.java
@@ -10,8 +10,11 @@
 import java.net.URI;
 import java.util.Iterator;
 
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 
 import org.eclipse.jetty.http.HttpStatus;
 import org.junit.Ignore;
@@ -20,8 +23,6 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -44,14 +45,14 @@
     @Ignore   
     @Test
     public void testGetJSONQuery () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());
@@ -64,37 +65,37 @@
     @Ignore
     @Test
     public void testbuildAndPostQuery () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
 
-        response = resource().path(API_VERSION).path("search")
+        response = target().path(API_VERSION).path("search")
                 .request()
-                .post(ClientResponse.class, query);
+                .post(Entity.json(query));
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String matches = response.getEntity(String.class);
+        String matches = response.readEntity(String.class);
         JsonNode match_node = JsonUtils.readTree(matches);
         assertNotEquals(0, match_node.path("matches").size());
     }
 
     @Test
     public void testApiWelcomeMessage () {
-        ClientResponse response = resource().path(API_VERSION).path("")
+        Response response = target().path(API_VERSION).path("")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String message = response.getEntity(String.class);
+        String message = response.readEntity(String.class);
         assertEquals(
             "Wes8Bd4h1OypPqbWF5njeQ==",
             response.getHeaders().getFirst("X-Index-Revision")
@@ -104,14 +105,14 @@
 
     @Test
     public void testQueryGet () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());
@@ -122,15 +123,15 @@
 
     @Test
     public void testQueryFailure () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das").queryParam("ql", "poliqarp")
                 .queryParam("cq", "corpusSigle=WPD | corpusSigle=GOE")
                 .queryParam("count", "13")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .get();
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
@@ -143,14 +144,14 @@
 
     @Test
     public void testFoundryRewrite () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());
@@ -164,12 +165,12 @@
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[orth=das]", "poliqarp");
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .request()
-                .post(ClientResponse.class, s.toJSON());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .post(Entity.json(s.toJSON()));
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());
@@ -178,15 +179,15 @@
 
     @Test
     public void testParameterField () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("fields", "author,docSigle")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());
@@ -197,14 +198,14 @@
 
     @Test
     public void testMatchInfoGetWithoutSpans () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
                 .queryParam("foundry", "*").queryParam("spans", "false")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
@@ -215,14 +216,14 @@
 
     @Test
     public void testMatchInfoGetWithoutHighlights () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
                 .queryParam("foundry", "xy").queryParam("spans", "false")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertEquals(
@@ -236,15 +237,15 @@
 
     @Test
     public void testMatchInfoWithoutExtension () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42")
                 .queryParam("foundry", "-").queryParam("spans", "false")
                 .queryParam("expand","false")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
@@ -258,15 +259,15 @@
     
     @Test
     public void testMatchInfoGetWithHighlights () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("corpus/GOE/AGA/01784/p36-46(5)37-45(2)38-42/matchInfo")
                 .queryParam("foundry", "xy").queryParam("spans", "false")
                 .queryParam("hls", "true")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
@@ -287,15 +288,15 @@
 
     @Test
     public void testMatchInfoGet2 () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
 
                 .path("corpus/GOE/AGA/01784/p36-46/matchInfo")
                 .queryParam("foundry", "*")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertEquals("GOE/AGA/01784", node.at("/textSigle").asText());
@@ -306,16 +307,16 @@
     @Ignore
     @Test
     public void testCollectionQueryParameter () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("fields", "author, docSigle")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .queryParam("cq", "textClass=Politik & corpus=WPD")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());
@@ -323,20 +324,20 @@
                 node.at("/collection/operands/0/value").asText());
         assertEquals("WPD", node.at("/collection/operands/1/value").asText());
 
-        response = resource().path(API_VERSION).path("search")
+        response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("fields", "author, docSigle")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .queryParam("cq", "textClass=Politik & corpus=WPD")
                 .request()
-                .get(ClientResponse.class);
+                .get();
         // String version =
         // LucenePackage.get().getImplementationVersion();;
         // System.out.println("VERSION "+ version);
         // System.out.println("RESPONSE "+ response);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        query = response.getEntity(String.class);
+        query = response.readEntity(String.class);
         node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());
@@ -347,13 +348,13 @@
 
     @Test
     public void testMetaFields () throws KustvaktException {
-        ClientResponse response =
-                resource().path(API_VERSION).path("/corpus/GOE/AGA/01784")
+        Response response =
+                target().path(API_VERSION).path("/corpus/GOE/AGA/01784")
                         .request()
-                        .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                        .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String resp = response.getEntity(String.class);
+        String resp = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(resp);
         // System.err.println(node.toString());
 
@@ -403,10 +404,10 @@
 
     @Test
     public void testSearchWithoutVersion () throws KustvaktException {
-        ClientResponse response = resource().path("api").path("search")
+        Response response = target().path("api").path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .request()
-                .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+                .accept(MediaType.APPLICATION_JSON).get();
         assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
         URI location = response.getLocation();
         assertEquals("/api/v1.0/search", location.getPath());
@@ -414,12 +415,12 @@
 
     @Test
     public void testSearchWrongVersion () throws KustvaktException {
-        ClientResponse response = resource().path("api").path("v0.2")
+        Response response = target().path("api").path("v0.2")
                 .path("search").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp")
-                .accept(MediaType.APPLICATION_JSON)
                 .request()
-                .get(ClientResponse.class);
+                .accept(MediaType.APPLICATION_JSON)
+                .get();
         assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
         URI location = response.getLocation();
         assertEquals("/api/v1.0/search", location.getPath());
@@ -427,46 +428,46 @@
 
     @Test
     public void testSearchWithIP () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "Wasser").queryParam("ql", "poliqarp")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertTrue(node.at("/collection").isMissingNode());
     }
 
     @Test
     public void testSearchWithAuthorizationHeader () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "Wasser").queryParam("ql", "poliqarp")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("test", "pwd"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertTrue(node.at("/collection").isMissingNode());
     }
     
     @Test
     public void testSearchPublicMetadata () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("access-rewrite-disabled", "true")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
 
         assertTrue(node.at("/matches/0/snippet").isMissingNode());
@@ -474,15 +475,15 @@
     
     @Test
     public void testSearchPublicMetadataWithCustomFields () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "Sonne").queryParam("ql", "poliqarp")
                 .queryParam("fields", "author,title")
                 .queryParam("access-rewrite-disabled", "true")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         
         assertTrue(node.at("/matches/0/snippet").isMissingNode());
@@ -495,15 +496,15 @@
     
     @Test
     public void testSearchPublicMetadataWithNonPublicField () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "Sonne").queryParam("ql", "poliqarp")
                 .queryParam("fields", "author,title,snippet")
                 .queryParam("access-rewrite-disabled", "true")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(StatusCodes.NON_PUBLIC_FIELD_IGNORED,
@@ -516,14 +517,14 @@
     
     @Test
     public void testSearchWithInvalidPage () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=die]").queryParam("ql", "poliqarp")
                 .queryParam("page", "0")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .get();
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.INVALID_ARGUMENT, node.at("/errors/0/0").asInt());
         assertEquals("page must start from 1",node.at("/errors/0/1").asText());
@@ -534,14 +535,13 @@
         searchKrill.getStatistics(null);
         assertEquals(true, searchKrill.getIndex().isReaderOpen());
 
-        MultivaluedMap<String, String> m = new MultivaluedMapImpl();
-        m.add("token", "secret");
+        Form form = new Form();
+        form.param("token", "secret");
 
-        ClientResponse response = resource().path(API_VERSION).path("index")
+        Response response = target().path(API_VERSION).path("index")
                 .path("close")
                 .request()
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
-                .post(ClientResponse.class, m);
+                .post(Entity.form(form));
 
         assertEquals(HttpStatus.OK_200, response.getStatus());
         assertEquals(false, searchKrill.getIndex().isReaderOpen());
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchPipeTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchPipeTest.java
index 9922ce0..867a159 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchPipeTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchPipeTest.java
@@ -25,7 +25,9 @@
 import org.mockserver.model.Header;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 
 import de.ids_mannheim.korap.config.LiteJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -111,16 +113,16 @@
                                 "application/json; charset=utf-8"))
                         .withBody(pipeJson).withStatusCode(200));
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", glemmUri)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.at("/query/wrap/key").size());
 
@@ -152,13 +154,13 @@
 
         glemmUri = URLEncoder.encode(glemmUri, "utf-8");
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", glemmUri)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.at("/query/wrap/key").size());
     }
@@ -178,16 +180,16 @@
                         .withBody(pipeWithParamJson).withStatusCode(200));
 
         String glemmUri2 = glemmUri + "?param=blah";
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", glemmUri + "," + glemmUri2)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(3, node.at("/query/wrap/key").size());
     }
@@ -196,16 +198,16 @@
     public void testSearchWithUnknownURL ()
             throws IOException, KustvaktException {
         String url =
-                resource().getURI().toString() + API_VERSION + "/test/tralala";
-        ClientResponse response = resource().path(API_VERSION).path("search")
+                target().getUri().toString() + API_VERSION + "/test/tralala";
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", url)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.PIPE_FAILED, node.at("/warnings/0/0").asInt());
@@ -214,16 +216,16 @@
 
     @Test
     public void testSearchWithUnknownHost () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", "http://glemm")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(StatusCodes.PIPE_FAILED, node.at("/warnings/0/0").asInt());
@@ -238,14 +240,14 @@
 
         String pipeUri = "http://localhost:"+port+"/non-json-pipe";
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", pipeUri)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        String entity = response.readEntity(String.class);
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -257,17 +259,17 @@
     @Test
     public void testSearchWithMultiplePipeWarnings () throws KustvaktException {
         String url =
-                resource().getURI().toString() + API_VERSION + "/test/tralala";
-        ClientResponse response = resource().path(API_VERSION).path("search")
+                target().getUri().toString() + API_VERSION + "/test/tralala";
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", url + "," + "http://glemm")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(2, node.at("/warnings").size());
@@ -294,14 +296,14 @@
                                 "application/json; charset=utf-8")));
 
         String pipeUri = "http://localhost:"+port+"/invalid-response";
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", pipeUri)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        String entity = response.readEntity(String.class);
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -320,14 +322,14 @@
                 .respond(response().withBody("blah").withStatusCode(200));
 
         String pipeUri = "http://localhost:"+port+"/plain-text";
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", pipeUri)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        String entity = response.readEntity(String.class);
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -350,30 +352,30 @@
                                 "application/json; charset=utf-8"))
                         .withBody(pipeJson).withStatusCode(200));
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", "http://unknown" + "," + glemmUri)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.at("/query/wrap/key").size());
         assertTrue(node.at("/warnings").isMissingNode());
 
-        response = resource().path(API_VERSION).path("search")
+        response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("pipes", glemmUri + ",http://unknown")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        entity = response.getEntity(String.class);
+        entity = response.readEntity(String.class);
         node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.PIPE_FAILED, node.at("/warnings/0/0").asInt());
     }
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchTokenSnippetTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchTokenSnippetTest.java
index a091ecf..5602657 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchTokenSnippetTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteSearchTokenSnippetTest.java
@@ -7,7 +7,9 @@
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 
 import de.ids_mannheim.korap.config.LiteJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -18,16 +20,16 @@
 
     @Test
     public void testSearchWithTokens () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("show-tokens", "true")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
 
         assertTrue(node.at("/matches/0/hasSnippet").asBoolean());
@@ -39,16 +41,16 @@
     
     @Test
     public void testSearchWithoutTokens () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("show-tokens", "false")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
 
         assertTrue(node.at("/matches/0/hasSnippet").asBoolean());
@@ -58,17 +60,17 @@
     
     @Test
     public void testSearchPublicMetadataWithTokens () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=das]").queryParam("ql", "poliqarp")
                 .queryParam("access-rewrite-disabled", "true")
                 .queryParam("show-tokens", "true")
                 .queryParam("context", "sentence").queryParam("count", "13")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
 
         assertFalse(node.at("/matches/0/hasSnippet").asBoolean());
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java
index 99a05b4..2c7b726 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LiteStatisticControllerTest.java
@@ -5,14 +5,15 @@
 
 import java.io.IOException;
 
+import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
 
 import de.ids_mannheim.korap.config.LiteJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -23,12 +24,12 @@
 
     @Test
     public void testStatisticsWithCq () throws KustvaktException{
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .queryParam("cq", "textType=Abhandlung & corpusSigle=GOE")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
         assertEquals(
@@ -36,7 +37,7 @@
             response.getHeaders().getFirst("X-Index-Revision")
             );
         
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertEquals(2, node.at("/documents").asInt());
         assertEquals(138180, node.at("/tokens").asInt());
@@ -48,15 +49,15 @@
     
     @Test
     public void testStatisticsWithCqAndCorpusQuery () throws KustvaktException{
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .queryParam("cq", "textType=Abhandlung & corpusSigle=GOE")
                 .queryParam("corpusQuery", "textType=Autobiographie & corpusSigle=GOE")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertEquals(2, node.at("/documents").asInt());
         assertEquals(138180, node.at("/tokens").asInt());
@@ -68,14 +69,14 @@
     
     @Test
     public void testStatisticsWithCorpusQuery () throws KustvaktException{
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .queryParam("corpusQuery", "textType=Autobiographie & corpusSigle=GOE")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertEquals(9, node.at("/documents").asInt());
         assertEquals(527662, node.at("/tokens").asInt());
@@ -90,27 +91,27 @@
 
     @Test
     public void testEmptyStatistics () throws KustvaktException{
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
             .path("statistics")
             .queryParam("corpusQuery", "")
             .request()
-            .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+            .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String query = response.getEntity(String.class);
+        String query = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(query);
         assertEquals(11, node.at("/documents").asInt());
         assertEquals(665842, node.at("/tokens").asInt());
         assertEquals(25074, node.at("/sentences").asInt());
         assertEquals(772, node.at("/paragraphs").asInt());
 
-        response = resource().path(API_VERSION)
+        response = target().path(API_VERSION)
                 .path("statistics")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        query = response.getEntity(String.class);
+        query = response.readEntity(String.class);
         node = JsonUtils.readTree(query);
         assertEquals(11, node.at("/documents").asInt());
         assertEquals(665842, node.at("/tokens").asInt());
@@ -121,22 +122,22 @@
     @Test
     public void testGetStatisticsWithKoralQuery ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class,"{ \"collection\" : {\"@type\": "
+                .post(Entity.json("{ \"collection\" : {\"@type\": "
                         + "\"koral:doc\", \"key\": \"availability\", \"match\": "
                         + "\"match:eq\", \"type\": \"type:regex\", \"value\": "
-                        + "\"CC-BY.*\"} }");
+                        + "\"CC-BY.*\"} }"));
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                      response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
 
         assertEquals(
             "Wes8Bd4h1OypPqbWF5njeQ==",
-            response.getMetadata().getFirst("X-Index-Revision")
+            response.getHeaders().getFirst("X-Index-Revision")
             );
         
         JsonNode node = JsonUtils.readTree(ent);
@@ -149,15 +150,15 @@
     @Test
     public void testGetStatisticsWithEmptyCollection ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class,"{}");
+                .post(Entity.json("{}"));
 
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                      response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(node.at("/errors/0/0").asInt(),
                 de.ids_mannheim.korap.util.StatusCodes.MISSING_COLLECTION);
@@ -168,15 +169,15 @@
     @Test
     public void testGetStatisticsWithIncorrectJson ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class,"{ \"collection\" : }");
+                .post(Entity.json("{ \"collection\" : }"));
 
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                      response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(StatusCodes.DESERIALIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -187,13 +188,13 @@
     @Test
     public void testGetStatisticsWithoutKoralQuery ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .request()
-                .post(ClientResponse.class);
+                .post(Entity.json(""));
         
-        String ent = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        String ent = response.readEntity(String.class);
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
         
         JsonNode node = JsonUtils.readTree(ent);
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/SearchNetworkEndpointTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/SearchNetworkEndpointTest.java
index a4f9dc6..6377608 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/SearchNetworkEndpointTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/SearchNetworkEndpointTest.java
@@ -19,7 +19,8 @@
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.config.LiteJerseyTest;
@@ -75,16 +76,16 @@
                                 "application/json; charset=utf-8"))
                         .withBody(searchResult).withStatusCode(200));
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("engine", "network")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(2, node.at("/matches").size());
@@ -95,17 +96,17 @@
     public void testSearchWithUnknownURL ()
             throws IOException, KustvaktException {
         config.setNetworkEndpointURL("http://localhost:1040/search");
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("engine", "network")
                 .request()
-                .get(ClientResponse.class);
+                .get();
         
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.SEARCH_NETWORK_ENDPOINT_FAILED,
                 node.at("/errors/0/0").asInt());
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
     }
     
@@ -113,17 +114,17 @@
     public void testSearchWithUnknownHost () throws KustvaktException {
         config.setNetworkEndpointURL("http://search.com");
         
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("engine", "network")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.SEARCH_NETWORK_ENDPOINT_FAILED,
                 node.at("/errors/0/0").asInt());
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
     }
 }