diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/service/OltuAuthorizationService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/service/OltuAuthorizationService.java
index 6aa82d1..cb72f53 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/service/OltuAuthorizationService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/service/OltuAuthorizationService.java
@@ -15,7 +15,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import com.sun.jersey.api.client.ClientResponse.Status;
+import javax.ws.rs.core.Response.Status;
 
 import de.ids_mannheim.korap.encryption.RandomCodeGenerator;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
diff --git a/full/src/test/java/de/ids_mannheim/korap/authentication/AuthenticationFilterTest.java b/full/src/test/java/de/ids_mannheim/korap/authentication/AuthenticationFilterTest.java
index 449268b..4873674 100644
--- a/full/src/test/java/de/ids_mannheim/korap/authentication/AuthenticationFilterTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/authentication/AuthenticationFilterTest.java
@@ -5,7 +5,7 @@
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.Attributes;
 import de.ids_mannheim.korap.config.SpringJerseyTest;
@@ -17,13 +17,13 @@
     @Test
     public void testAuthenticationWithUnknownScheme ()
             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")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Blah blah")
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode n = JsonUtils.readTree(entity);
 
         assertEquals("2001", n.at("/errors/0/0").asText());
diff --git a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
index 5e531e4..ea19da9 100644
--- a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
+++ b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapOAuth2Test.java
@@ -5,6 +5,7 @@
 import java.net.URI;
 import java.security.GeneralSecurityException;
 
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response.Status;
 
 import org.apache.http.entity.ContentType;
@@ -20,8 +21,9 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 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.client.Entity;
 import com.unboundid.ldap.sdk.LDAPException;
 
 import de.ids_mannheim.korap.config.Attributes;
@@ -79,12 +81,12 @@
     public void testRequestTokenPasswordUnknownUser ()
             throws KustvaktException {
 
-        ClientResponse response = requestTokenWithPassword(superClientId,
+        Response response = requestTokenWithPassword(superClientId,
                 clientSecret, "unknown", "password");
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(2023, node.at("/errors/0/0").asInt());
@@ -95,9 +97,9 @@
 
     @Test
     public void testMapUsernameToEmail () throws KustvaktException {
-        ClientResponse response = requestTokenWithPassword(superClientId,
+        Response response = requestTokenWithPassword(superClientId,
                 clientSecret, "testUser", "password");
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         
@@ -126,14 +128,14 @@
         json.setDescription(
                 "Test registering a public client with LDAP authentication");
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("register")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).post(ClientResponse.class);
+                .post(Entity.json(json));
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         String clientId = node.at("/client_id").asText();
@@ -151,14 +153,14 @@
         json.setDescription(
                 "Test registering a confidential client with LDAP authentication");
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("register")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).post(ClientResponse.class);
+                .post(Entity.json(json));
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         String clientId = node.at("/client_id").asText();
@@ -170,14 +172,14 @@
     private void testRequestTokenWithAuthorization (String clientId,
             String clientSecret, String accessToken) throws KustvaktException {
         String authHeader = "Bearer " + accessToken;
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("authorize")
                 .queryParam("response_type", "code")
                 .queryParam("client_id", clientId)
                 .queryParam("client_secret", clientSecret)
                 .request()
                 .header(Attributes.AUTHORIZATION, authHeader)
-                .get(ClientResponse.class);
+                .get();
         
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
                 response.getStatus());
@@ -188,7 +190,7 @@
         String code = params.getFirst("code");
 
         response = requestTokenWithAuthorizationCodeAndForm(clientId, clientSecret, code);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
 
         String at = node.at("/access_token").asText();
         AccessToken accessTokenObj = accessDao.retrieveAccessToken(at);
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 4d91607..677201c 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
@@ -5,14 +5,15 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.MediaType;
 
 import org.junit.Test;
 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.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -49,27 +50,26 @@
         String json = "{\"pos-foundry\":\"opennlp\"}";
         String username = "foundryRewriteTest";
         String pathUsername = "~" + username;
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path(pathUsername).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .type(MediaType.APPLICATION_JSON).entity(json)
-                .put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
         // search
-        response = resource().path(API_VERSION).path("search")
+        response = target().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);
+                .accept(MediaType.APPLICATION_JSON).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);
         assertEquals("opennlp", node.at("/query/wrap/foundry").asText());
         assertEquals("foundry",
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 6f22b3a..810ef7b 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
@@ -5,7 +5,7 @@
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -23,13 +23,13 @@
     public void testRewriteRefNotFound ()
             throws KustvaktException, Exception {
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
             .queryParam("q", "[orth=der]{%23examplequery} Baum")
             .queryParam("ql", "poliqarp")
             .request()
-            .get(ClientResponse.class);
+            .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals("Query system/examplequery is not found.",
                 node.at("/errors/0/1").asText());
@@ -39,13 +39,13 @@
     public void testRewriteSystemQuery ()
             throws KustvaktException, Exception {
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
             .queryParam("q", "[orth=der]{%23system-q} Baum")
             .queryParam("ql", "poliqarp")
             .request()
-            .get(ClientResponse.class);
+            .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
 //        System.out.println(ent);
         JsonNode node = JsonUtils.readTree(ent);
     }
@@ -55,15 +55,15 @@
             throws KustvaktException, Exception {
 
         // Added in the database migration sql for tests
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().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);
+            .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals("koral:token", node.at("/query/operands/1/@type").asText());
         assertEquals("@type(koral:queryRef)",
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 f0b771e..84a5056 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
@@ -12,7 +12,7 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.cache.VirtualCorpusCache;
@@ -42,13 +42,13 @@
         vcLoader.loadVCToCache("named-vc1", "/vc/named-vc1.jsonld");
         assertTrue(VirtualCorpusCache.contains("named-vc1"));
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("cq", "referTo named-vc1")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         node = node.at("/collection");
 
@@ -68,13 +68,13 @@
     private void testRefCachedVCWithUsername ()
             throws KustvaktException, IOException, QueryException {
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("cq", "referTo \"system/named-vc1\"")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         node = node.at("/collection");
         assertEquals("koral:docGroup", node.at("/@type").asText());
@@ -89,13 +89,13 @@
     @Test
     public void testRewriteFreeAndSystemVCRef ()
             throws KustvaktException, Exception {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("cq", "referTo \"system-vc\"")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         node = node.at("/collection");
 
@@ -115,16 +115,16 @@
 
     @Test
     public void testRewritePubAndSystemVCRef () 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("cq", "referTo \"system/system-vc\"")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("user", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         node = node.at("/collection");
         assertEquals("koral:docGroup", node.at("/@type").asText());
@@ -141,15 +141,15 @@
     public void testRewriteWithDoryVCRef ()
             throws KustvaktException, IOException, QueryException {
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().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);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         node = node.at("/collection");
         assertEquals("koral:docGroup", node.at("/@type").asText());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java b/full/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java
index e5f9eb9..d83400a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/ApiVersionTest.java
@@ -9,7 +9,7 @@
 import org.eclipse.jetty.http.HttpStatus;
 import org.junit.Test;
 
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -22,10 +22,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/"+API_VERSION+"/search", location.getPath());
@@ -33,12 +33,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")
                 .request()
                 .accept(MediaType.APPLICATION_JSON)
-                .get(ClientResponse.class);
+                .get();
         assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
         URI location = response.getLocation();
         assertEquals("/api/"+API_VERSION+"/search", location.getPath());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/InitialSuperClientTest.java b/full/src/test/java/de/ids_mannheim/korap/web/InitialSuperClientTest.java
index 46e2526..fbb1d19 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/InitialSuperClientTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/InitialSuperClientTest.java
@@ -12,7 +12,7 @@
 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 de.ids_mannheim.korap.config.FullConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -54,10 +54,10 @@
 
     private void testLogin (String superClientId, String superClientSecret)
             throws KustvaktException {
-        ClientResponse response = requestTokenWithPassword(superClientId,
+        Response response = requestTokenWithPassword(superClientId,
                 superClientSecret, "username", "password");
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         assertTrue(!node.at("/access_token").isMissingNode());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/AnnotationControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/AnnotationControllerTest.java
index caec944..e005476 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/AnnotationControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/AnnotationControllerTest.java
@@ -6,12 +6,12 @@
 import java.util.Iterator;
 import java.util.Map.Entry;
 
-import javax.ws.rs.core.MediaType;
+import javax.ws.rs.client.Entity;
 
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -20,12 +20,12 @@
 public class AnnotationControllerTest extends SpringJerseyTest {
     @Test
     public void testAnnotationLayers () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("annotation").path("layers")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode n = JsonUtils.readTree(entity);
 
         assertEquals(31, n.size());
@@ -39,14 +39,14 @@
 
     @Test
     public void testAnnotationFoundry () throws KustvaktException {
-        ClientResponse response =
-                resource().path(API_VERSION).path("annotation")
-                        .path("description").type(MediaType.APPLICATION_JSON)
-                        .entity("{\"codes\":[\"opennlp/*\"], \"language\":\"en\"}")
+        String json = "{\"codes\":[\"opennlp/*\"], \"language\":\"en\"}";
+        Response response =
+                target().path(API_VERSION).path("annotation")
+                        .path("description")
                         .request()
-                        .post(ClientResponse.class);
+                        .post(Entity.json(json));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode n = JsonUtils.readTree(entity);
 
         n = n.get(0);
@@ -67,14 +67,14 @@
 
     @Test
     public void testAnnotationValues () throws KustvaktException {
-        ClientResponse response =
-                resource().path(API_VERSION).path("annotation")
-                        .path("description").type(MediaType.APPLICATION_JSON)
-                        .entity("{\"codes\":[\"mate/m\"], \"language\":\"en\"}")
+        String json = "{\"codes\":[\"mate/m\"], \"language\":\"en\"}";
+        Response response =
+                target().path(API_VERSION).path("annotation")
+                        .path("description")
                         .request()
-                        .post(ClientResponse.class);
+                        .post(Entity.json(json));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode n = JsonUtils.readTree(entity);
 
         n = n.get(0);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java
index 80bd635..8ebe6a6 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/AuthenticationControllerTest.java
@@ -10,7 +10,8 @@
 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.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -34,13 +35,14 @@
     public void testSessionToken() throws KustvaktException {
         String auth = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue( 
                 credentials[0], credentials[1]);
-        ClientResponse response = resource().path("auth")
-                .path("sessionToken").header(Attributes.AUTHORIZATION, auth)
+        Response response = target().path("auth")
+                .path("sessionToken")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .header(Attributes.AUTHORIZATION, auth)
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String en = response.getEntity(String.class);
+        String en = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(en);
         assertNotNull(node);
 
@@ -52,22 +54,23 @@
         assertNotEquals("", token_type);
         assertFalse(TimeUtils.isExpired(ex.getMillis()));
 
-        response = resource().path("user")
-                .path("info").header(Attributes.AUTHORIZATION, token_type + " "+ token)
+        response = target().path("user")
+                .path("info")
                 .request()
-                .get(ClientResponse.class);
-        en = response.getEntity(String.class);
+                .header(Attributes.AUTHORIZATION, token_type + " "+ token)
+                .get();
+        en = response.readEntity(String.class);
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
         
-        response = resource().path("auth")
+        response = target().path("auth")
                 .path("logout")
                 .request()
                 .header(Attributes.AUTHORIZATION, token_type + " "+ token)
-                .get(ClientResponse.class);
+                .get();
         
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
     }
 
@@ -75,13 +78,14 @@
     public void testSessionTokenExpire() throws KustvaktException {
         String auth = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(
                 credentials[0], credentials[1]);
-        ClientResponse response = resource().path("auth")
-                .path("sessionToken").header(Attributes.AUTHORIZATION, auth)
+        Response response = target().path("auth")
+                .path("sessionToken")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .header(Attributes.AUTHORIZATION, auth)
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        String en = response.getEntity(String.class);
+        String en = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(en);
         assertNotNull(node);
 
@@ -96,17 +100,17 @@
             if (TimeUtils.isExpired(ex.getMillis()))
                 break;
         }
-        response = resource().path("user")
+        response = target().path("user")
                 .path("info")
                 .request()
                 .header(Attributes.AUTHORIZATION, token_type + " "+ token)
-                .get(ClientResponse.class);
-        en = response.getEntity(String.class);
+                .get();
+        en = response.readEntity(String.class);
         node = JsonUtils.readTree(en);
         assertNotNull(node);
 
         assertEquals(StatusCodes.BAD_CREDENTIALS, node.at("/errors/0/0").asInt());
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
     }
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
index 6e49b48..a6b6e42 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/AvailabilityTest.java
@@ -9,8 +9,9 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 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.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -137,18 +138,18 @@
 
 
 
-    private ClientResponse searchQuery (String collectionQuery) {
-        return resource().path(API_VERSION).path("search").queryParam("q", "[orth=das]")
+    private Response searchQuery (String collectionQuery) {
+        return target().path(API_VERSION).path("search").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp").queryParam("cq", collectionQuery)
                 .request()
-                .get(ClientResponse.class);
+                .get();
     }
 
 
-    private ClientResponse searchQueryWithIP (String collectionQuery, String ip)
+    private Response searchQueryWithIP (String collectionQuery, String ip)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        return resource().path(API_VERSION).path("search").queryParam("q", "[orth=das]")
+        return target().path(API_VERSION).path("search").queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp").queryParam("cq", collectionQuery)
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -156,60 +157,60 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, ip)
-                .get(ClientResponse.class);
+                .get();
     }
 
 
     @Test
     public void testAvailabilityFreeAuthorized () throws KustvaktException {
-        ClientResponse response = searchQuery("availability = CC-BY-SA");
+        Response response = searchQuery("availability = CC-BY-SA");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
 
     @Test
     public void testAvailabilityRegexFreeAuthorized ()
             throws KustvaktException {
-        ClientResponse response = searchQuery("availability = /.*BY.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = searchQuery("availability = /.*BY.*/");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
 
     @Test
     public void testAvailabilityFreeUnauthorized () throws KustvaktException {
-        ClientResponse response = searchQuery("availability = ACA-NC");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = searchQuery("availability = ACA-NC");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
 
     @Test
     public void testAvailabilityRegexFreeUnauthorized ()
             throws KustvaktException {
-        ClientResponse response = searchQuery("availability = /ACA.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = searchQuery("availability = /ACA.*/");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
     @Test
     public void testAvailabilityRegexNoRewrite () throws KustvaktException {
-        ClientResponse response = searchQuery(
+        Response response = searchQuery(
                 "availability = /CC-BY.*/ & availability = /ACA.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String json = response.getEntity(String.class);
+        String json = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(json);
         assertEquals("operation:and",
@@ -232,11 +233,11 @@
     @Test
     public void testAvailabilityRegexFreeUnauthorized3 ()
             throws KustvaktException {
-        ClientResponse response = searchQuery("availability = /.*NC.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = searchQuery("availability = /.*NC.*/");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        // System.out.println(response.getEntity(String.class));
-        checkAndFree(response.getEntity(String.class));
+        // System.out.println(response.readEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
 
@@ -244,186 +245,186 @@
     @Test
     public void testNegationAvailabilityFreeUnauthorized ()
             throws KustvaktException {
-        ClientResponse response = searchQuery("availability != /CC-BY.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = searchQuery("availability != /CC-BY.*/");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
     @Test
     public void testNegationAvailabilityFreeUnauthorized2 ()
             throws KustvaktException {
-        ClientResponse response = searchQuery("availability != /.*BY.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = searchQuery("availability != /.*BY.*/");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
     @Test
     public void testNegationAvailabilityWithOperationOrUnauthorized ()
             throws KustvaktException {
-        ClientResponse response = searchQuery(
+        Response response = searchQuery(
                 "availability = /CC-BY.*/ | availability != /CC-BY.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
     @Test
     public void testComplexNegationAvailabilityFreeUnauthorized ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQuery("textClass=politik & availability != /CC-BY.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
 
     @Test
     public void testComplexAvailabilityFreeUnauthorized ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQuery("textClass=politik & availability=ACA-NC");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
 
     @Test
     public void testComplexAvailabilityFreeUnauthorized3 ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQuery("textClass=politik & availability=/.*NC.*/");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
 
     @Test
     public void testAvailabilityPublicAuthorized () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQueryWithIP("availability=ACA-NC", "149.27.0.32");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndPublic(response.getEntity(String.class));
+        checkAndPublic(response.readEntity(String.class));
     }
 
 
     @Test
     public void testAvailabilityPublicUnauthorized () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQueryWithIP("availability=QAO-NC-LOC:ids", "149.27.0.32");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndPublic(response.getEntity(String.class));
+        checkAndPublic(response.readEntity(String.class));
     }
 
 
     @Test
     public void testAvailabilityRegexPublicAuthorized ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQueryWithIP("availability= /ACA.*/", "149.27.0.32");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndPublicWithACA(response.getEntity(String.class));
+        checkAndPublicWithACA(response.readEntity(String.class));
     }
 
 
     @Test
     public void testNegationAvailabilityPublicUnauthorized ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQueryWithIP("availability != ACA-NC", "149.27.0.32");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndPublic(response.getEntity(String.class));
+        checkAndPublic(response.readEntity(String.class));
     }
 
 
     @Test
     public void testNegationAvailabilityRegexPublicUnauthorized ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQueryWithIP("availability != /ACA.*/", "149.27.0.32");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndPublic(response.getEntity(String.class));
+        checkAndPublic(response.readEntity(String.class));
     }
 
 
     @Test
     public void testComplexAvailabilityPublicUnauthorized ()
             throws KustvaktException {
-        ClientResponse response = searchQueryWithIP(
+        Response response = searchQueryWithIP(
                 "textClass=politik & availability=QAO-NC-LOC:ids",
                 "149.27.0.32");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndPublic(response.getEntity(String.class));
+        checkAndPublic(response.readEntity(String.class));
     }
 
 
     @Test
     public void testNegationComplexAvailabilityPublicUnauthorized ()
             throws KustvaktException {
-        ClientResponse response = searchQueryWithIP(
+        Response response = searchQueryWithIP(
                 "textClass=politik & availability!=QAO-NC-LOC:ids",
                 "149.27.0.32");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndPublic(response.getEntity(String.class));
+        checkAndPublic(response.readEntity(String.class));
     }
 
     @Test
     public void testAvailabilityRegexAllAuthorized () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQueryWithIP("availability= /ACA.*/", "10.27.0.32");
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndAllWithACA(response.getEntity(String.class));
+        checkAndAllWithACA(response.readEntity(String.class));
     }
 
     @Test
     public void testAvailabilityOr () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQuery("availability=/CC-BY.*/ | availability=/ACA.*/");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
     @Test
     public void testRedundancyOrPub () throws KustvaktException {
-        ClientResponse response = searchQueryWithIP(
+        Response response = searchQueryWithIP(
                 "availability=/CC-BY.*/ | availability=/ACA.*/ | availability=/QAO-NC/",
                 "149.27.0.32");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        String json = response.getEntity(String.class);
+        String json = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(json);
         assertTrue(node.at("/collection/rewrites").isMissingNode());
         assertEquals("operation:or", node.at("/collection/operation").asText());
@@ -431,33 +432,33 @@
 
     @Test
     public void testAvailabilityOrCorpusSigle () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQuery("availability=/CC-BY.*/ | corpusSigle=GOE");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
     @Test
     public void testOrWithoutAvailability () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 searchQuery("corpusSigle=GOE | textClass=politik");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 
     @Test
     public void testWithoutAvailability () throws KustvaktException {
-        ClientResponse response = searchQuery("corpusSigle=GOE");
+        Response response = searchQuery("corpusSigle=GOE");
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        checkAndFree(response.getEntity(String.class));
+        checkAndFree(response.readEntity(String.class));
     }
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/FreeResourceControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/FreeResourceControllerTest.java
index d684c94..dbe693a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/FreeResourceControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/FreeResourceControllerTest.java
@@ -6,7 +6,7 @@
 import org.springframework.test.context.ContextConfiguration;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -17,12 +17,12 @@
     
     @Test
     public void testResource () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("resource")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode n = JsonUtils.readTree(entity).get(0);
         assertEquals("WPD17",n.at("/resourceId").asText());
         assertEquals("Deutsche Wikipedia Artikel 2017", n.at("/titles/de").asText());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/IndexControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/IndexControllerTest.java
index 80587f6..dc9dcaa 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/IndexControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/IndexControllerTest.java
@@ -10,16 +10,16 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+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 org.apache.http.HttpStatus;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -57,13 +57,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")
-                .path("close").type(MediaType.APPLICATION_FORM_URLENCODED)
+        Response response = target().path(API_VERSION).path("index")
+                .path("close")
                 .request()
-                .post(ClientResponse.class, m);
+                .post(Entity.form(form));
 
         assertEquals(HttpStatus.SC_OK, response.getStatus());
         assertEquals(false, searchKrill.getIndex().isReaderOpen());
@@ -73,19 +73,19 @@
         
         Thread.sleep(200);
 
-        response = resource().path(API_VERSION).path("vc").path("~system")
+        response = target().path(API_VERSION).path("vc").path("~system")
                 .path("named-vc1")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("admin", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
-        response = resource().path(API_VERSION).path("vc").path("~system")
+        response = target().path(API_VERSION).path("vc").path("~system")
                 .path("named-vc1")
                 .request()
-                .get(ClientResponse.class);
+                .get();
         
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,node.at("/errors/0/0").asInt());
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/InfoControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/InfoControllerTest.java
index a1a83b7..113fe5b 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/InfoControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/InfoControllerTest.java
@@ -6,8 +6,8 @@
 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.SpringJerseyTest;
@@ -26,13 +26,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/full/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
index cd62baf..efe1faf 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/MatchInfoControllerTest.java
@@ -8,7 +8,8 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-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.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -22,15 +23,15 @@
     @Test
     public void testGetMatchInfoPublicCorpus () throws KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGA").path("01784").path("p36-100")
                 .path("matchInfo").queryParam("foundry", "*")
                 .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);
 
         assertNotNull(node);
@@ -46,15 +47,15 @@
     @Test
     public void testGetMatchInfoNotAllowed () throws KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGI").path("04846").path("p36875-36876")
                 .path("matchInfo").queryParam("foundry", "*")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
@@ -68,7 +69,7 @@
 
     @Test
     public void testGetMatchInfoWithAuthentication () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGI").path("04846").path("p36875-36876")
                 .path("matchInfo").queryParam("foundry", "*")
                 .request()
@@ -77,10 +78,10 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "172.27.0.32")
-                .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);
@@ -100,7 +101,7 @@
 
     @Test
     public void testAvailabilityAll () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGD").path("00000").path("p75-76")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -108,15 +109,15 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "10.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
     }
 
     @Test
     public void testAvailabilityAllUnauthorized () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGD").path("00000").path("p75-76")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -124,9 +125,9 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "170.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
         assertEquals(
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/MetadataControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/MetadataControllerTest.java
index 5d6ddeb..5fab35d 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/MetadataControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/MetadataControllerTest.java
@@ -8,7 +8,8 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-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.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -21,15 +22,15 @@
 
     @Test
     public void testRetrieveMetadataWithField () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGA").path("01784")
                 .queryParam("fields", "author")
                 .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("author", node.at("/document/fields/0/key").asText());
@@ -38,15 +39,15 @@
 
     @Test
     public void testRetrieveMetadataWithMultipleFields () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGA").path("01784")
                 .queryParam("fields", "author,title")
                 .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("author", node.at("/document/fields/0/key").asText());
@@ -56,14 +57,14 @@
     @Test
     public void testFreeMetadata () throws KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGA").path("01784")
                 .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);
 
         assertTrue(!node.at("/document").isMissingNode());
@@ -75,14 +76,14 @@
     @Ignore
     public void testMetadataUnauthorized () throws KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGI").path("04846")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
@@ -95,7 +96,7 @@
 
     @Test
     public void testMetadataWithAuthentication () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGI").path("04846")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -103,15 +104,15 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "172.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
     }
 
     @Test
     public void testMetadataAvailabilityAll () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGI").path("00000")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -119,9 +120,9 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "10.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
     }
 
@@ -130,7 +131,7 @@
     @Ignore
     public void testMetadataAvailabilityAllUnauthorized ()
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus")
+        Response response = target().path(API_VERSION).path("corpus")
                 .path("GOE").path("AGD").path("00000")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -138,9 +139,9 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "170.27.0.32")
-                .get(ClientResponse.class);
+                .get();
         
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
         assertEquals(
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/MultipleCorpusQueryTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/MultipleCorpusQueryTest.java
index 6f2a5f0..23fd917 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/MultipleCorpusQueryTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/MultipleCorpusQueryTest.java
@@ -7,8 +7,9 @@
 
 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.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -19,15 +20,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/operands/1");
         assertEquals("koral:docGroup", node.at("/@type").asText());
@@ -45,14 +46,14 @@
     public void testStatisticsWithMultipleCq ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        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,15 +67,15 @@
     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/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AccessTokenTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AccessTokenTest.java
index d7b11a5..ba2497f 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AccessTokenTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AccessTokenTest.java
@@ -7,7 +7,9 @@
 import java.io.IOException;
 import java.net.URI;
 
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response.Status;
 
 import org.apache.http.entity.ContentType;
@@ -18,8 +20,7 @@
 
 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 javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -44,27 +45,27 @@
 
     @Test
     public void testScopeWithSuperClient () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestTokenWithDoryPassword(superClientId, clientSecret);
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals("all", node.at("/scope").asText());
         String accessToken = node.at("/access_token").asText();
 
         // test list user group
-        response = resource().path(API_VERSION).path("group")
+        response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(2, node.size());
     }
 
     @Test
     public void testCustomScope () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestAuthorizationCode("code", confidentialClientId, "",
                         OAuth2Scope.VC_INFO.toString(), "", userAuthHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
@@ -76,31 +77,31 @@
         
         response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
 
         String token = node.at("/access_token").asText();
         assertTrue(node.at("/scope").asText()
                 .contains(OAuth2Scope.VC_INFO.toString()));
 
         // test list vc using the token
-        response = resource().path(API_VERSION).path("vc")
+        response = target().path(API_VERSION).path("vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer " + token)
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(4, node.size());
     }
 
     @Test
     public void testDefaultScope () throws KustvaktException, IOException {
         String code = requestAuthorizationCode(confidentialClientId, userAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String accessToken = node.at("/access_token").asText();
         testScopeNotAuthorized(accessToken);
         testScopeNotAuthorize2(accessToken);
@@ -109,14 +110,14 @@
 
     private void testScopeNotAuthorized (String accessToken)
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -126,14 +127,14 @@
 
     private void testScopeNotAuthorize2 (String accessToken)
             throws KustvaktException {
-        ClientResponse response =
-                resource().path(API_VERSION).path("vc").path("access")
+        Response response =
+                target().path(API_VERSION).path("vc").path("access")
                         .request()
                         .header(Attributes.AUTHORIZATION,
                                 "Bearer " + accessToken)
-                        .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+                        .get();
+        String entity = response.readEntity(String.class);
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
@@ -145,13 +146,13 @@
     @Test
     public void testSearchWithUnknownToken ()
             throws KustvaktException, IOException {
-        ClientResponse response =
+        Response response =
                 searchWithAccessToken("ljsa8tKNRSczJhk20öhq92zG8z350");
 
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(StatusCodes.INVALID_ACCESS_TOKEN,
                 node.at("/errors/0/0").asInt());
@@ -168,16 +169,16 @@
                 confidentialClientId, code, clientAuthHeader);
 
         String accessToken = node.at("/access_token").asText();
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("token", accessToken);
-        form.add("client_id", confidentialClientId);
-        form.add("client_secret", "secret");
+        Form form = new Form();
+        form.param("token", accessToken);
+        form.param("client_id", confidentialClientId);
+        form.param("client_secret", "secret");
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2").path("revoke")
+        Response response = target().path(API_VERSION).path("oauth2").path("revoke")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -189,10 +190,10 @@
             throws KustvaktException {
         String code = requestAuthorizationCode(publicClientId,
                 userAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 publicClientId, "", code);
         
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String accessToken = node.at("/access_token").asText();
         testRevokeTokenViaSuperClient(accessToken, userAuthHeader);
         testSearchWithRevokedAccessToken(accessToken);
@@ -209,20 +210,20 @@
         String accessToken = node.at("/access_token").asText();
         String refreshToken = node.at("/refresh_token").asText();
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", GrantType.REFRESH_TOKEN.toString());
-        form.add("client_id", confidentialClientId);
-        form.add("client_secret", "secret");
-        form.add("refresh_token", refreshToken);
+        Form form = new Form();
+        form.param("grant_type", GrantType.REFRESH_TOKEN.toString());
+        form.param("client_id", confidentialClientId);
+        form.param("client_secret", "secret");
+        form.param("refresh_token", refreshToken);
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2").path("token")
+        Response response = target().path(API_VERSION).path("oauth2").path("token")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         node = JsonUtils.readTree(entity);
@@ -241,12 +242,12 @@
                 confidentialClientId, code, clientAuthHeader);
         String userAuthToken = node.at("/access_token").asText();
 
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 confidentialClientId, "", "", "", "Bearer " + userAuthToken);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
         assertEquals("Scope authorize is not authorized",
@@ -256,9 +257,9 @@
     @Test
     public void testRequestAuthorizationWithBearerToken ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestTokenWithDoryPassword(superClientId, clientSecret);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         
         JsonNode node = JsonUtils.readTree(entity);
         String userAuthToken = node.at("/access_token").asText();
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
index 7049ad6..3464dfd 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AdminControllerTest.java
@@ -3,7 +3,8 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
 
 import org.apache.http.entity.ContentType;
 import org.junit.Test;
@@ -12,10 +13,10 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.ClientResponse.Status;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Response.Status;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -43,18 +44,18 @@
                 .createBasicAuthorizationHeaderValue("dory", "password");
     }
 
-    private ClientResponse updateClientPrivilege (String username,
-            MultivaluedMap<String, String> form)
+    private Response updateClientPrivilege (String username,
+            Form form)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("admin").path("client").path("privilege")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         return response;
     }
@@ -62,12 +63,12 @@
     private void updateClientPriviledge (String clientId, boolean isSuper)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("client_id", clientId);
-        form.add("super", Boolean.toString(isSuper));
+        Form form = new Form();
+        form.param("client_id", clientId);
+        form.param("super", Boolean.toString(isSuper));
 
-        ClientResponse response = updateClientPrivilege(username, form);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        Response response = updateClientPrivilege(username, form);
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -85,11 +86,11 @@
         int accessTokensBefore = accessDao.retrieveInvalidAccessTokens().size();
         assertTrue(accessTokensBefore > 0);
 
-        resource().path(API_VERSION).path("oauth2").path("admin").path("token")
+        target().path(API_VERSION).path("oauth2").path("admin").path("token")
                 .path("clean")
                 .request()
                 .header(Attributes.AUTHORIZATION, adminAuthHeader)
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(0, refreshDao.retrieveInvalidRefreshTokens().size());
         assertEquals(0, accessDao.retrieveInvalidAccessTokens().size());
@@ -101,9 +102,9 @@
         int accessTokensBefore = accessDao.retrieveInvalidAccessTokens().size();
         String code = requestAuthorizationCode(publicClientId, userAuthHeader);
 
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 publicClientId, clientSecret, code);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         String accessToken = node.at("/access_token").asText();
@@ -112,11 +113,11 @@
         int accessTokensAfter = accessDao.retrieveInvalidAccessTokens().size();
         assertEquals(accessTokensAfter, accessTokensBefore + 1);
 
-        resource().path(API_VERSION).path("oauth2").path("admin").path("token")
+        target().path(API_VERSION).path("oauth2").path("admin").path("token")
                 .path("clean")
                 .request()
                 .header(Attributes.AUTHORIZATION, adminAuthHeader)
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(0, accessDao.retrieveInvalidAccessTokens().size());
     }
@@ -124,8 +125,8 @@
     @Test
     public void testUpdateClientPrivilege () throws KustvaktException {
         // register a client
-        ClientResponse response = registerConfidentialClient(username);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        Response response = registerConfidentialClient(username);
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String clientId = node.at("/client_id").asText();
         String clientSecret = node.at("/client_secret").asText();
 
@@ -154,14 +155,14 @@
         assertTrue(node.at("/super").asBoolean());
 
         // list vc
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
-                .get(ClientResponse.class);
+                .get();
 
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -178,11 +179,11 @@
         JsonNode node = retrieveClientInfo(clientId, username);
         assertTrue(node.at("/isSuper").isMissingNode());
 
-        ClientResponse response = searchWithAccessToken(accessToken);
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        Response response = searchWithAccessToken(accessToken);
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.INVALID_ACCESS_TOKEN,
                 node.at("/errors/0/0").asInt());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AuthorizationPostTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AuthorizationPostTest.java
index f58126d..67b5cbb 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AuthorizationPostTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2AuthorizationPostTest.java
@@ -5,6 +5,9 @@
 
 import java.net.URI;
 
+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 org.apache.http.entity.ContentType;
@@ -15,10 +18,9 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
-import com.sun.jersey.api.uri.UriComponent;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import org.glassfish.jersey.uri.UriComponent;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -34,27 +36,27 @@
                 .createBasicAuthorizationHeaderValue("dory", "password");
     }
     
-    private ClientResponse requestAuthorizationCode (
-            MultivaluedMap<String, String> form, String authHeader)
+    private Response requestAuthorizationCode (
+            Form form, String authHeader)
             throws KustvaktException {
 
-        return resource().path(API_VERSION).path("oauth2").path("authorize")
+        return target().path(API_VERSION).path("oauth2").path("authorize")
                 .request()
                 .header(Attributes.AUTHORIZATION, authHeader)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
     }
     
     @Test
     public void testAuthorizeConfidentialClient () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("response_type", "code");
-        form.add("client_id", confidentialClientId);
-        form.add("state", "thisIsMyState");
+        Form form = new Form();
+        form.param("response_type", "code");
+        form.param("client_id", confidentialClientId);
+        form.param("state", "thisIsMyState");
 
-        ClientResponse response =
+        Response response =
                 requestAuthorizationCode(form, userAuthHeader);
 
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
@@ -70,12 +72,12 @@
     public void testRequestTokenAuthorizationConfidential ()
             throws KustvaktException {
 
-        MultivaluedMap<String, String> authForm = new MultivaluedMapImpl();
-        authForm.add("response_type", "code");
-        authForm.add("client_id", confidentialClientId);
-        authForm.add("scope", "search");
+        Form authForm = new Form();
+        authForm.param("response_type", "code");
+        authForm.param("client_id", confidentialClientId);
+        authForm.param("scope", "search");
 
-        ClientResponse response =
+        Response response =
                 requestAuthorizationCode(authForm, userAuthHeader);
         URI redirectUri = response.getLocation();
         MultivaluedMap<String, String> params =
@@ -87,7 +89,7 @@
 
         response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node.at("/access_token").asText());
         assertNotNull(node.at("/refresh_token").asText());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
index d52bba7..f158fb6 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ClientControllerTest.java
@@ -12,7 +12,8 @@
 import java.util.Map.Entry;
 import java.util.Set;
 
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.http.entity.ContentType;
@@ -22,11 +23,12 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-import com.sun.jersey.spi.container.ContainerRequest;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.client.Entity;
+
+import org.glassfish.jersey.server.ContainerRequest;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -51,11 +53,11 @@
                 .createBasicAuthorizationHeaderValue("dory", "password");
     }
 
-    private void checkWWWAuthenticateHeader (ClientResponse response) {
-        Set<Entry<String, List<String>>> headers =
+    private void checkWWWAuthenticateHeader (Response response) {
+        Set<Entry<String, List<Object>>> headers =
                 response.getHeaders().entrySet();
 
-        for (Entry<String, List<String>> header : headers) {
+        for (Entry<String, List<Object>> header : headers) {
             if (header.getKey().equals(ContainerRequest.WWW_AUTHENTICATE)) {
                 assertEquals("Basic realm=\"Kustvakt\"",
                         header.getValue().get(0));
@@ -112,8 +114,8 @@
     
     @Test
     public void testRegisterConfidentialClient () throws KustvaktException {
-        ClientResponse response = registerConfidentialClient(username);
-        String entity = response.getEntity(String.class);
+        Response response = registerConfidentialClient(username);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         String clientId = node.at("/client_id").asText();
@@ -135,8 +137,8 @@
         OAuth2ClientJson clientJson =
                 createOAuth2ClientJson("R", OAuth2ClientType.PUBLIC, null);
 
-        ClientResponse response = registerClient(username, clientJson);
-        String entity = response.getEntity(String.class);
+        Response response = registerClient(username, clientJson);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals("client_name must contain at least 3 characters",
                 node.at("/error_description").asText());
@@ -150,8 +152,8 @@
         OAuth2ClientJson clientJson =
                 createOAuth2ClientJson("", OAuth2ClientType.PUBLIC, null);
 
-        ClientResponse response = registerClient(username, clientJson);
-        String entity = response.getEntity(String.class);
+        Response response = registerClient(username, clientJson);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals("client_name must contain at least 3 characters",
                 node.at("/error_description").asText());
@@ -166,8 +168,8 @@
         OAuth2ClientJson clientJson =
                 createOAuth2ClientJson(null, OAuth2ClientType.PUBLIC, null);
 
-        ClientResponse response = registerClient(username, clientJson);
-        String entity = response.getEntity(String.class);
+        Response response = registerClient(username, clientJson);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals("client_name is null",
                 node.at("/error_description").asText());
@@ -182,8 +184,8 @@
         OAuth2ClientJson clientJson = createOAuth2ClientJson("R client",
                 OAuth2ClientType.PUBLIC, null);
 
-        ClientResponse response = registerClient(username, clientJson);
-        String entity = response.getEntity(String.class);
+        Response response = registerClient(username, clientJson);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals("client_description is null",
                 node.at("/error_description").asText());
@@ -198,8 +200,8 @@
         OAuth2ClientJson clientJson =
                 createOAuth2ClientJson("R client", null, null);
 
-        ClientResponse response = registerClient(username, clientJson);
-        String entity = response.getEntity(String.class);
+        Response response = registerClient(username, clientJson);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals("client_type is null",
                 node.at("/error_description").asText());
@@ -217,22 +219,22 @@
                 createOAuth2ClientJson("OAuth2PublicClient",
                         OAuth2ClientType.PUBLIC, "A public test client.");
         clientJson.setRedirectURI(redirectUri);
-        ClientResponse response = registerClient(username, clientJson);
-        testInvalidRedirectUri(response.getEntity(String.class), false,
+        Response response = registerClient(username, clientJson);
+        testInvalidRedirectUri(response.readEntity(String.class), false,
                 response.getStatus());
 
         // localhost is not allowed
         redirectUri = "http://localhost:1410";
         clientJson.setRedirectURI(redirectUri);
         response = registerClient(username, clientJson);
-        testInvalidRedirectUri(response.getEntity(String.class), false,
+        testInvalidRedirectUri(response.readEntity(String.class), false,
                 response.getStatus());
         
         // fragment is not allowed
         redirectUri = "https://public.client.com/redirect.html#bar";
         clientJson.setRedirectURI(redirectUri);
         response = registerClient(username, clientJson);
-        testInvalidRedirectUri(response.getEntity(String.class), false,
+        testInvalidRedirectUri(response.readEntity(String.class), false,
                 response.getStatus());
     }
     
@@ -244,8 +246,8 @@
                 createOAuth2ClientJson("OAuth2PublicClient",
                         OAuth2ClientType.PUBLIC, "A public test client.");
         clientJson.setRefreshTokenExpiry(31535000);
-        ClientResponse response = registerClient(username, clientJson);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        Response response = registerClient(username, clientJson);
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals("invalid_request", node.at("/error").asText());
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
     }
@@ -259,8 +261,8 @@
                 createOAuth2ClientJson("OAuth2 Confidential Client",
                         OAuth2ClientType.CONFIDENTIAL, "A confidential client.");
         clientJson.setRefreshTokenExpiry(expiry);
-        ClientResponse response = registerClient(username, clientJson);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        Response response = registerClient(username, clientJson);
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String clientId = node.at("/client_id").asText();
         JsonNode clientInfo = retrieveClientInfo(clientId, username);
         assertEquals(expiry, clientInfo.at("/refresh_token_expiry").asInt());
@@ -276,8 +278,8 @@
                 "OAuth2 Confidential Client", OAuth2ClientType.CONFIDENTIAL,
                 "A confidential client.");
         clientJson.setRefreshTokenExpiry(31537000);
-        ClientResponse response = registerClient(username, clientJson);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        Response response = registerClient(username, clientJson);
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(
                 "Maximum refresh token expiry is 31536000 seconds (1 year)",
                 node.at("/error_description").asText());
@@ -295,14 +297,14 @@
                 createOAuth2ClientJson("OAuth2PublicClient",
                         OAuth2ClientType.PUBLIC, "A public test client.");
         clientJson.setUrl(url);
-        ClientResponse response = registerClient(username, clientJson);
-        testInvalidUrl(response.getEntity(String.class), response.getStatus());
+        Response response = registerClient(username, clientJson);
+        testInvalidUrl(response.readEntity(String.class), response.getStatus());
 
         // localhost is not allowed
         url = "http://localhost:1410";
         clientJson.setRedirectURI(url);
         response = registerClient(username, clientJson);
-        testInvalidUrl(response.getEntity(String.class), response.getStatus());
+        testInvalidUrl(response.readEntity(String.class), response.getStatus());
     }
     
     private void testInvalidUrl (String entity, 
@@ -326,9 +328,9 @@
         clientJson.setUrl("http://public.client.com/index.html#bar");
         clientJson.setRedirectURI(redirectUri);
 
-        ClientResponse response = registerClient(username, clientJson);
+        Response response = registerClient(username, clientJson);
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         String clientId = node.at("/client_id").asText();
@@ -347,25 +349,25 @@
         String userAuthHeader = HttpAuthorizationHandler
                 .createBasicAuthorizationHeaderValue("dory", "password");
         String code = requestAuthorizationCode(clientId, userAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 clientId, clientSecret, code);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
 
         assertEquals("match_info search", node.at("/scope").asText());
 
         String accessToken = node.at("/access_token").asText();
 
         OAuth2ClientJson clientJson = createOAuth2ClientJson("R client",
-                OAuth2ClientType.PUBLIC, null);
+                        OAuth2ClientType.PUBLIC, null);
 
-        response = resource().path(API_VERSION).path("oauth2").path("client")
+        response = target().path(API_VERSION).path("oauth2").path("client")
                 .path("register")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(clientJson).post(ClientResponse.class);
+                .post(Entity.json(clientJson));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -383,7 +385,7 @@
                 .getResourceAsStream("json/oauth2_public_client.json");
         String json = IOUtils.toString(is, Charset.defaultCharset());
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("register")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -391,9 +393,9 @@
                                 .createBasicAuthorizationHeaderValue(username,
                                         "password"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).post(ClientResponse.class);
+                .post(Entity.json(json));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         String clientId = node.at("/client_id").asText();
@@ -411,9 +413,9 @@
                 "OAuth2DesktopClient", OAuth2ClientType.PUBLIC,
                 "This is a desktop test client.");
 
-        ClientResponse response = registerClient(username, clientJson);
+        Response response = registerClient(username, clientJson);
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         String clientId = node.at("/client_id").asText();
@@ -435,9 +437,9 @@
                 createOAuth2ClientJson("OAuth2DesktopClient1",
                         OAuth2ClientType.PUBLIC, "A desktop test client.");
 
-        ClientResponse response = registerClient(username, clientJson);
+        Response response = registerClient(username, clientJson);
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         String clientId1 = node.at("/client_id").asText();
@@ -450,7 +452,7 @@
 
         response = registerClient(username, clientJson);
 
-        entity = response.getEntity(String.class);
+        entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         node = JsonUtils.readTree(entity);
         String clientId2 = node.at("/client_id").asText();
@@ -472,9 +474,9 @@
 
         String code = requestAuthorizationCode(clientId, redirectUri, userAuthHeader);
         
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 clientId, clientSecret, code, redirectUri);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String accessToken = node.at("/access_token").asText();
 
         response = searchWithAccessToken(accessToken);
@@ -486,13 +488,13 @@
         response = requestTokenWithAuthorizationCodeAndForm(clientId,
                 clientSecret, code, redirectUri);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(OAuth2Error.INVALID_CLIENT.toString(),
                 node.at("/error").asText());
 
         response = searchWithAccessToken(accessToken);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.INVALID_ACCESS_TOKEN,
                 node.at("/errors/0/0").asInt());
         assertEquals("Access token is invalid",
@@ -503,14 +505,14 @@
             String clientId) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("deregister").path(clientId)
                 .request()
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -520,12 +522,12 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("deregister")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.METHOD_NOT_ALLOWED.getStatusCode(),
                 response.getStatus());
@@ -535,12 +537,12 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("deregister").path(clientId)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
     }
@@ -548,19 +550,19 @@
     private void testResetPublicClientSecret (String clientId)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("client_id", clientId);
+        Form form = new Form();
+        form.param("client_id", clientId);
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("reset")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
@@ -571,20 +573,20 @@
     private String testResetConfidentialClientSecret (String clientId,
             String clientSecret) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("client_id", clientId);
-        form.add("client_secret", clientSecret);
+        Form form = new Form();
+        form.param("client_id", clientId);
+        form.param("client_secret", clientSecret);
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("reset")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -598,20 +600,20 @@
 
     private void requestAuthorizedClientList (String userAuthHeader)
             throws KustvaktException {
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        form.add("authorized_only", "true");
+        Form form = getSuperClientForm();
+        form.param("authorized_only", "true");
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("list")
                 .request()
                 .header(Attributes.AUTHORIZATION, userAuthHeader)
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.size());
@@ -674,7 +676,7 @@
                 .createBasicAuthorizationHeaderValue(username, password);
 
         // super client
-        ClientResponse response = requestTokenWithPassword(superClientId,
+        Response response = requestTokenWithPassword(superClientId,
                 clientSecret, username, password);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -684,7 +686,7 @@
                 code);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String accessToken = node.at("/access_token").asText();
 
         // client 2
@@ -704,7 +706,7 @@
                 accessToken);
 
         // revoke client 2
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         accessToken = node.at("/access_token").asText();
         refreshToken = node.at("/refresh_token").asText();
         testRevokeAllTokenViaSuperClient(confidentialClientId, userAuthHeader,
@@ -718,7 +720,7 @@
         // client 2
         String code =
                 requestAuthorizationCode(confidentialClientId, userAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
@@ -730,7 +732,7 @@
             String userAuthHeader) throws KustvaktException {
         // client 1
         String code = requestAuthorizationCode(publicClientId, userAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 publicClientId, "", code);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
@@ -746,10 +748,10 @@
 
         // client 1
         String code = requestAuthorizationCode(publicClientId, aaaAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 publicClientId, "", code);
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String accessToken1 = node.at("/access_token").asText();
 
         // client 2
@@ -757,7 +759,7 @@
         response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
 
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         String accessToken2 = node.at("/access_token").asText();
         String refreshToken = node.at("/refresh_token").asText();
 
@@ -776,26 +778,26 @@
             String userAuthHeader, String accessToken)
             throws KustvaktException {
         // check token before revoking
-        ClientResponse response = searchWithAccessToken(accessToken);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        Response response = searchWithAccessToken(accessToken);
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertTrue(node.at("/matches").size() > 0);
 
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        form.add("client_id", clientId);
+        Form form = getSuperClientForm();
+        form.param("client_id", clientId);
 
-        response = resource().path(API_VERSION).path("oauth2").path("revoke")
+        response = target().path(API_VERSION).path("oauth2").path("revoke")
                 .path("super").path("all")
                 .request()
                 .header(Attributes.AUTHORIZATION, userAuthHeader)
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        assertEquals("SUCCESS", response.getEntity(String.class));
+        assertEquals("SUCCESS", response.readEntity(String.class));
 
         response = searchWithAccessToken(accessToken);
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.INVALID_ACCESS_TOKEN,
                 node.at("/errors/0/0").asInt());
         assertEquals("Access token is invalid",
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
index 38ed47c..bfd0ad9 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
@@ -8,6 +8,9 @@
 import java.time.ZonedDateTime;
 import java.util.Set;
 
+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.Status;
 
@@ -19,8 +22,7 @@
 
 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 javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -46,7 +48,7 @@
     @Test
     public void testAuthorizeConfidentialClient () throws KustvaktException {
         // with registered redirect URI
-        ClientResponse response =
+        Response response =
                 requestAuthorizationCode("code", confidentialClientId, "",
                         "match_info search client_info", state, userAuthHeader);
 
@@ -69,7 +71,7 @@
 
     @Test
     public void testAuthorizeWithRedirectUri () throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestAuthorizationCode("code", publicClientId2,
                         "https://public.com/redirect", "", "", userAuthHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
@@ -87,7 +89,7 @@
 
     @Test
     public void testAuthorizeWithoutScope () throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 confidentialClientId, "", "", "", userAuthHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
                 response.getStatus());
@@ -104,10 +106,10 @@
 
     @Test
     public void testAuthorizeMissingClientId () throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("code", "", "", "",
+        Response response = requestAuthorizationCode("code", "", "", "",
                 "", userAuthHeader);
         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("Missing parameters: client_id",
                 node.at("/error_description").asText());
@@ -115,11 +117,11 @@
 
     @Test
     public void testAuthorizeMissingRedirectUri () throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 publicClientId2, "", "", state, userAuthHeader);
         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(OAuthError.CodeResponse.INVALID_REQUEST,
                 node.at("/error").asText());
@@ -130,7 +132,7 @@
 
     @Test
     public void testAuthorizeMissingResponseType() throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("",
+        Response response = requestAuthorizationCode("",
                 confidentialClientId, "", "", "", userAuthHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
                 response.getStatus());
@@ -142,12 +144,12 @@
     
     @Test
     public void testAuthorizeMissingResponseTypeWithoutClientId () throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("",
+        Response response = requestAuthorizationCode("",
                 "", "", "", "", userAuthHeader);
         
         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(OAuthError.CodeResponse.INVALID_REQUEST,
@@ -158,10 +160,10 @@
 
     @Test
     public void testAuthorizeInvalidClientId () throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 "unknown-client-id", "", "", "", userAuthHeader);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_CLIENT, node.at("/error").asText());
         assertEquals("Unknown client: unknown-client-id",
@@ -171,28 +173,28 @@
     @Test
     public void testAuthorizeDifferentRedirectUri () throws KustvaktException {
         String redirectUri = "https://different.uri/redirect";
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 confidentialClientId, redirectUri, "", state, userAuthHeader);
-        testInvalidRedirectUri(response.getEntity(String.class), true,
+        testInvalidRedirectUri(response.readEntity(String.class), true,
                 response.getStatus());
     }
 
     @Test
     public void testAuthorizeWithRedirectUriLocalhost ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestAuthorizationCode("code", publicClientId2,
                         "http://localhost:1410", "", state, userAuthHeader);
-        testInvalidRedirectUri(response.getEntity(String.class), true,
+        testInvalidRedirectUri(response.readEntity(String.class), true,
                 response.getStatus());    }
 
     @Test
     public void testAuthorizeWithRedirectUriFragment ()
             throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 publicClientId2, "http://public.com/index.html#redirect", "",
                 state, userAuthHeader);
-        testInvalidRedirectUri(response.getEntity(String.class), true,
+        testInvalidRedirectUri(response.readEntity(String.class), true,
                 response.getStatus());
     }
 
@@ -200,16 +202,16 @@
     public void testAuthorizeInvalidRedirectUri () throws KustvaktException {
         // host not allowed by Apache URI Validator
         String redirectUri = "https://public.uri/redirect";
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 publicClientId2, redirectUri, "", state, userAuthHeader);
-        testInvalidRedirectUri(response.getEntity(String.class), true,
+        testInvalidRedirectUri(response.readEntity(String.class), true,
                 response.getStatus());
     }
 
     @Test
     public void testAuthorizeInvalidResponseType () throws KustvaktException {
         // without redirect URI in the request
-        ClientResponse response = requestAuthorizationCode("string",
+        Response response = requestAuthorizationCode("string",
                 confidentialClientId, "", "", state, userAuthHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
                 response.getStatus());
@@ -236,7 +238,7 @@
                 redirectUri, "", state, userAuthHeader);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(OAuthError.CodeResponse.INVALID_REQUEST,
                 node.at("/error").asText());
         assertEquals("Invalid redirect URI",
@@ -249,7 +251,7 @@
                 state, userAuthHeader);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(OAuthError.CodeResponse.INVALID_REQUEST,
                 node.at("/error").asText());
         assertEquals("Missing parameter: redirect URI",
@@ -260,7 +262,7 @@
     @Test
     public void testAuthorizeInvalidScope () throws KustvaktException {
         String scope = "read_address";
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 confidentialClientId, "", scope, state, userAuthHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
                 response.getStatus());
@@ -275,7 +277,7 @@
     @Test
     public void testAuthorizeUnsupportedTokenResponseType ()
             throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("token",
+        Response response = requestAuthorizationCode("token",
                 confidentialClientId, "", "", state, userAuthHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
                 response.getStatus());
@@ -291,9 +293,9 @@
             throws KustvaktException {
         String code = requestAuthorizationCode(publicClientId, userAuthHeader);
 
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 publicClientId, clientSecret, code);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         String accessToken = node.at("/access_token").asText();
@@ -312,7 +314,7 @@
             throws KustvaktException {
 
         String scope = "search";
-        ClientResponse response = requestAuthorizationCode("code",
+        Response response = requestAuthorizationCode("code",
                 confidentialClientId, "", scope, state, userAuthHeader);
         MultivaluedMap<String, String> params =
                 getQueryParamsFromURI(response.getLocation());
@@ -323,7 +325,7 @@
 
         response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node.at("/access_token").asText());
         assertNotNull(node.at("/refresh_token").asText());
@@ -346,9 +348,9 @@
 
     private void testRequestTokenWithUsedAuthorization (String code)
             throws KustvaktException {
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
 
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
@@ -362,9 +364,9 @@
     @Test
     public void testRequestTokenInvalidAuthorizationCode ()
             throws KustvaktException {
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, "blahblah");
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
 
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
@@ -379,7 +381,7 @@
         String redirect_uri = "https://third.party.com/confidential/redirect";
         String scope = "search";
 
-        ClientResponse response =
+        Response response =
                 requestAuthorizationCode("code", confidentialClientId,
                         redirect_uri, scope, state, userAuthHeader);
         MultivaluedMap<String, String> params =
@@ -393,39 +395,39 @@
 
     private void testRequestTokenAuthorizationInvalidClient (String code)
             throws KustvaktException {
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, "wrong_secret", code);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_CLIENT, node.at("/error").asText());
     }
 
     private void testRequestTokenAuthorizationInvalidRedirectUri (String code)
             throws KustvaktException {
-        MultivaluedMap<String, String> tokenForm = new MultivaluedMapImpl();
-        tokenForm.add("grant_type", "authorization_code");
-        tokenForm.add("client_id", confidentialClientId);
-        tokenForm.add("client_secret", "secret");
-        tokenForm.add("code", code);
-        tokenForm.add("redirect_uri", "https://blahblah.com");
+        Form tokenForm = new Form();
+        tokenForm.param("grant_type", "authorization_code");
+        tokenForm.param("client_id", confidentialClientId);
+        tokenForm.param("client_secret", "secret");
+        tokenForm.param("code", code);
+        tokenForm.param("redirect_uri", "https://blahblah.com");
 
-        ClientResponse response = requestToken(tokenForm);
-        String entity = response.getEntity(String.class);
+        Response response = requestToken(tokenForm);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_GRANT, node.at("/error").asText());
     }
 
     private void testRequestTokenAuthorizationRevoked (String code, String uri)
             throws KustvaktException {
-        MultivaluedMap<String, String> tokenForm = new MultivaluedMapImpl();
-        tokenForm.add("grant_type", "authorization_code");
-        tokenForm.add("client_id", confidentialClientId);
-        tokenForm.add("client_secret", "secret");
-        tokenForm.add("code", code);
-        tokenForm.add("redirect_uri", uri);
+        Form tokenForm = new Form();
+        tokenForm.param("grant_type", "authorization_code");
+        tokenForm.param("client_id", confidentialClientId);
+        tokenForm.param("client_secret", "secret");
+        tokenForm.param("code", code);
+        tokenForm.param("redirect_uri", uri);
 
-        ClientResponse response = requestToken(tokenForm);
-        String entity = response.getEntity(String.class);
+        Response response = requestToken(tokenForm);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuthError.TokenResponse.INVALID_GRANT,
                 node.at("/error").asText());
@@ -436,12 +438,12 @@
     @Test
     public void testRequestTokenPasswordGrantConfidentialSuper ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestTokenWithDoryPassword(superClientId, clientSecret);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node.at("/access_token").asText());
         assertEquals(TokenType.BEARER.toString(),
@@ -461,9 +463,9 @@
     @Test
     public void testRequestTokenPasswordGrantConfidentialNonSuper ()
             throws KustvaktException {
-        ClientResponse response = requestTokenWithDoryPassword(
+        Response response = requestTokenWithDoryPassword(
                 confidentialClientId, clientSecret);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -476,9 +478,9 @@
     @Test
     public void testRequestTokenPasswordGrantPublic ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestTokenWithDoryPassword(publicClientId, "");
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
@@ -492,21 +494,21 @@
     @Test
     public void testRequestTokenPasswordGrantAuthorizationHeader ()
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "password");
-        form.add("client_id", superClientId);
-        form.add("username", "dory");
-        form.add("password", "password");
+        Form form = new Form();
+        form.param("grant_type", "password");
+        form.param("client_id", superClientId);
+        form.param("username", "dory");
+        form.param("password", "password");
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("token")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("token")
                         .request()
                         .header(HttpHeaders.AUTHORIZATION,
                                 "Basic ZkNCYlFrQXlZekk0TnpVeE1nOnNlY3JldA==")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                        .post(Entity.form(form));
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node.at("/access_token").asText());
         assertNotNull(node.at("/refresh_token").asText());
@@ -524,21 +526,21 @@
     @Test
     public void testRequestTokenPasswordGrantDifferentClientIds ()
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "password");
-        form.add("client_id", "9aHsGW6QflV13ixNpez");
-        form.add("username", "dory");
-        form.add("password", "password");
+        Form form = new Form();
+        form.param("grant_type", "password");
+        form.param("client_id", "9aHsGW6QflV13ixNpez");
+        form.param("username", "dory");
+        form.param("password", "password");
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("token")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("token")
                         .request()
                         .header(HttpHeaders.AUTHORIZATION,
                                 "Basic ZkNCYlFrQXlZekk0TnpVeE1nOnNlY3JldA==")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                        .post(Entity.form(form));
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node.at("/access_token").asText());
         assertNotNull(node.at("/refresh_token").asText());
@@ -550,11 +552,11 @@
     @Test
     public void testRequestTokenPasswordGrantMissingClientSecret ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestTokenWithDoryPassword(confidentialClientId, "");
         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(OAuthError.TokenResponse.INVALID_REQUEST,
                 node.at("/error").asText());
@@ -565,9 +567,9 @@
     @Test
     public void testRequestTokenPasswordGrantMissingClientId ()
             throws KustvaktException {
-        ClientResponse response =
+        Response response =
                 requestTokenWithDoryPassword(null, clientSecret);
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -581,12 +583,12 @@
     public void testRequestTokenClientCredentialsGrant ()
             throws KustvaktException {
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "client_credentials");
-        form.add("client_id", confidentialClientId);
-        form.add("client_secret", "secret");
-        ClientResponse response = requestToken(form);
-        String entity = response.getEntity(String.class);
+        Form form = new Form();
+        form.param("grant_type", "client_credentials");
+        form.param("client_id", confidentialClientId);
+        form.param("client_secret", "secret");
+        Response response = requestToken(form);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -606,13 +608,13 @@
     public void testRequestTokenClientCredentialsGrantPublic ()
             throws KustvaktException {
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "client_credentials");
-        form.add("client_id", publicClientId);
-        form.add("client_secret", "");
-        ClientResponse response = requestToken(form);
+        Form form = new Form();
+        form.param("grant_type", "client_credentials");
+        form.param("client_id", publicClientId);
+        form.param("client_secret", "");
+        Response response = requestToken(form);
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuthError.TokenResponse.INVALID_REQUEST,
@@ -625,14 +627,14 @@
     public void testRequestTokenClientCredentialsGrantReducedScope ()
             throws KustvaktException {
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "client_credentials");
-        form.add("client_id", confidentialClientId);
-        form.add("client_secret", "secret");
-        form.add("scope", "preferred_username client_info");
+        Form form = new Form();
+        form.param("grant_type", "client_credentials");
+        form.param("client_id", confidentialClientId);
+        form.param("client_secret", "secret");
+        form.param("scope", "preferred_username client_info");
 
-        ClientResponse response = requestToken(form);
-        String entity = response.getEntity(String.class);
+        Response response = requestToken(form);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -647,11 +649,11 @@
 
     @Test
     public void testRequestTokenMissingGrantType () throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        ClientResponse response = requestToken(form);
+        Form form = new Form();
+        Response response = requestToken(form);
         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(OAuthError.TokenResponse.INVALID_REQUEST,
                 node.at("/error").asText());
@@ -660,18 +662,18 @@
     @Test
     public void testRequestTokenUnsupportedGrant () throws KustvaktException {
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "blahblah");
+        Form form = new Form();
+        form.param("grant_type", "blahblah");
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("token")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("token")
                         .request()
                         .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
+                        .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -683,43 +685,43 @@
 
     private void testRequestRefreshTokenInvalidScope (String clientId,
             String refreshToken) throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", GrantType.REFRESH_TOKEN.toString());
-        form.add("client_id", clientId);
-        form.add("client_secret", clientSecret);
-        form.add("refresh_token", refreshToken);
-        form.add("scope", "search serialize_query");
+        Form form = new Form();
+        form.param("grant_type", GrantType.REFRESH_TOKEN.toString());
+        form.param("client_id", clientId);
+        form.param("client_secret", clientSecret);
+        form.param("refresh_token", refreshToken);
+        form.param("scope", "search serialize_query");
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("token")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("token")
                         .request()
                         .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
+                        .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_SCOPE, node.at("/error").asText());
     }
 
     private void testRequestRefreshToken (String clientId, String clientSecret,
             String refreshToken) throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", GrantType.REFRESH_TOKEN.toString());
-        form.add("client_id", clientId);
-        form.add("client_secret", clientSecret);
-        form.add("refresh_token", refreshToken);
+        Form form = new Form();
+        form.param("grant_type", GrantType.REFRESH_TOKEN.toString());
+        form.param("client_id", clientId);
+        form.param("client_secret", clientSecret);
+        form.param("refresh_token", refreshToken);
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("token")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("token")
                         .request()
                         .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
+                        .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -744,67 +746,67 @@
 
     private void testRequestRefreshTokenInvalidClient (String refreshToken)
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", GrantType.REFRESH_TOKEN.toString());
-        form.add("client_id", "iBr3LsTCxOj7D2o0A5m");
-        form.add("refresh_token", refreshToken);
+        Form form = new Form();
+        form.param("grant_type", GrantType.REFRESH_TOKEN.toString());
+        form.param("client_id", "iBr3LsTCxOj7D2o0A5m");
+        form.param("refresh_token", refreshToken);
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("token")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("token")
                         .request()
                         .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
+                        .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_CLIENT, node.at("/error").asText());
     }
 
     private void testRequestRefreshTokenInvalidRefreshToken (String clientId)
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", GrantType.REFRESH_TOKEN.toString());
-        form.add("client_id", clientId);
-        form.add("client_secret", clientSecret);
-        form.add("refresh_token", "Lia8s8w8tJeZSBlaQDrYV8ion3l");
+        Form form = new Form();
+        form.param("grant_type", GrantType.REFRESH_TOKEN.toString());
+        form.param("client_id", clientId);
+        form.param("client_secret", clientSecret);
+        form.param("refresh_token", "Lia8s8w8tJeZSBlaQDrYV8ion3l");
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("token")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("token")
                         .request()
                         .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
+                        .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_GRANT, node.at("/error").asText());
     }
 
     private JsonNode requestTokenList (String userAuthHeader, String tokenType,
             String clientId) throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("super_client_id", superClientId);
-        form.add("super_client_secret", clientSecret);
-        form.add("token_type", tokenType);
+        Form form = new Form();
+        form.param("super_client_id", superClientId);
+        form.param("super_client_secret", clientSecret);
+        form.param("token_type", tokenType);
 
         if (clientId != null && !clientId.isEmpty()) {
-            form.add("client_id", clientId);
+            form.param("client_id", clientId);
         }
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("token").path("list")
                 .request()
                 .header(Attributes.AUTHORIZATION, userAuthHeader)
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
 
@@ -822,10 +824,10 @@
                 .createBasicAuthorizationHeaderValue(username, password);
 
         // super client
-        ClientResponse response = requestTokenWithPassword(superClientId,
+        Response response = requestTokenWithPassword(superClientId,
                 clientSecret, username, password);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String refreshToken1 = node.at("/refresh_token").asText();
 
         // client 1
@@ -868,7 +870,7 @@
         response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
 
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         String refreshToken5 = node.at("/refresh_token").asText();
 
         // list all refresh tokens
@@ -915,10 +917,10 @@
 
         // access token 1
         String code = requestAuthorizationCode(publicClientId, userAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 publicClientId, "", code);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String accessToken1 = node.at("/access_token").asText();
 
         // access token 2
@@ -926,7 +928,7 @@
         response = requestTokenWithAuthorizationCodeAndForm(publicClientId, "",
                 code);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        node = JsonUtils.readTree(response.getEntity(String.class));
+        node = JsonUtils.readTree(response.readEntity(String.class));
         String accessToken2 = node.at("/access_token").asText();
 
         // list access tokens
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2OpenIdControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2OpenIdControllerTest.java
index 0f83a0e..01f70e1 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2OpenIdControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2OpenIdControllerTest.java
@@ -10,8 +10,8 @@
 import java.text.ParseException;
 import java.util.Date;
 
+import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
 
 import org.apache.http.entity.ContentType;
 import org.apache.oltu.oauth2.common.message.types.TokenType;
@@ -31,9 +31,9 @@
 import com.nimbusds.jwt.SignedJWT;
 import com.nimbusds.oauth2.sdk.GrantType;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.client.Entity;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -52,9 +52,9 @@
             "https://korap.ids-mannheim.de/confidential/redirect";
     private String username = "dory";
 
-    private ClientResponse sendAuthorizationRequest (
-            MultivaluedMap<String, String> form) throws KustvaktException {
-        return resource().path(API_VERSION).path("oauth2").path("openid").path("authorize")
+    private Response sendAuthorizationRequest (
+            Form form) throws KustvaktException {
+        return target().path(API_VERSION).path("oauth2").path("openid").path("authorize")
                 .request()
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
@@ -63,17 +63,17 @@
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
     }
 
-    private ClientResponse sendTokenRequest (
-            MultivaluedMap<String, String> form) throws KustvaktException {
-        return resource().path(API_VERSION).path("oauth2").path("openid").path("token")
+    private Response sendTokenRequest (
+            Form form) throws KustvaktException {
+        return target().path(API_VERSION).path("oauth2").path("openid").path("token")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
     }
 
     @Test
@@ -81,20 +81,20 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("response_type", "code");
-        form.add("client_id", "fCBbQkAyYzI4NzUxMg");
+        Form form = new Form();
+        form.param("response_type", "code");
+        form.param("client_id", "fCBbQkAyYzI4NzUxMg");
 
         testRequestAuthorizationCodeWithoutOpenID(form, redirectUri);
-        form.add("scope", "openid");
+        form.param("scope", "openid");
 
         testRequestAuthorizationCodeMissingRedirectUri(form);
         testRequestAuthorizationCodeInvalidRedirectUri(form);
-        form.add("redirect_uri", redirectUri);
+        form.param("redirect_uri", redirectUri);
 
-        form.add("state", "thisIsMyState");
+        form.param("state", "thisIsMyState");
 
-        ClientResponse response = sendAuthorizationRequest(form);
+        Response response = sendAuthorizationRequest(form);
         URI location = response.getLocation();
         assertEquals(redirectUri, location.getScheme() + "://"
                 + location.getHost() + location.getPath());
@@ -106,9 +106,9 @@
     }
 
     private void testRequestAuthorizationCodeWithoutOpenID (
-            MultivaluedMap<String, String> form, String redirectUri)
+            Form form, String redirectUri)
             throws KustvaktException {
-        ClientResponse response = sendAuthorizationRequest(form);
+        Response response = sendAuthorizationRequest(form);
         URI location = response.getLocation();
         // System.out.println(location.toString());
         assertEquals(redirectUri, location.getScheme() + "://"
@@ -116,9 +116,9 @@
     }
 
     private void testRequestAuthorizationCodeMissingRedirectUri (
-            MultivaluedMap<String, String> form) throws KustvaktException {
-        ClientResponse response = sendAuthorizationRequest(form);
-        String entity = response.getEntity(String.class);
+            Form form) throws KustvaktException {
+        Response response = sendAuthorizationRequest(form);
+        String entity = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
@@ -127,25 +127,25 @@
     }
 
     private void testRequestAuthorizationCodeInvalidRedirectUri (
-            MultivaluedMap<String, String> form) throws KustvaktException {
-        form.add("redirect_uri", "blah");
-        ClientResponse response = sendAuthorizationRequest(form);
-        String entity = response.getEntity(String.class);
+            Form form) throws KustvaktException {
+        form.param("redirect_uri", "blah");
+        Response response = sendAuthorizationRequest(form);
+        String entity = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
         assertEquals("Invalid redirect URI",
                 node.at("/error_description").asText());
 
-        form.remove("redirect_uri");
+        form.asMap().remove("redirect_uri");
     }
 
     @Test
     public void testRequestAuthorizationCodeMissingClientID ()
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("scope", "openid");
-        form.add("redirect_uri", redirectUri);
+        Form form = new Form();
+        form.param("scope", "openid");
+        form.param("redirect_uri", redirectUri);
 
         // error response is represented in JSON because redirect URI
         // cannot be verified without client id
@@ -154,8 +154,8 @@
         // before redirect_uri. see
         // com.nimbusds.oauth2.sdk.AuthorizationRequest
 
-        ClientResponse response = sendAuthorizationRequest(form);
-        String entity = response.getEntity(String.class);
+        Response response = sendAuthorizationRequest(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
         assertEquals("Invalid request: Missing client_id parameter",
@@ -166,17 +166,17 @@
     @Test
     public void testRequestAuthorizationCodeMissingResponseType ()
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("scope", "openid");
-        form.add("redirect_uri", redirectUri);
-        form.add("client_id", "blah");
+        Form form = new Form();
+        form.param("scope", "openid");
+        form.param("redirect_uri", redirectUri);
+        form.param("client_id", "blah");
 
         // client_id has not been verified yet
         // MUST NOT automatically redirect the user-agent to the
         // invalid redirection URI.
 
-        ClientResponse response = sendAuthorizationRequest(form);
-        String entity = response.getEntity(String.class);
+        Response response = sendAuthorizationRequest(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
         assertEquals("Invalid request: Missing response_type parameter",
@@ -184,13 +184,13 @@
     }
 
     private void testRequestAuthorizationCodeUnsupportedResponseType (
-            MultivaluedMap<String, String> form, String type)
+            Form form, String type)
             throws KustvaktException {
 
-        ClientResponse response = sendAuthorizationRequest(form);
+        Response response = sendAuthorizationRequest(form);
         URI location = response.getLocation();
         assertEquals(MediaType.APPLICATION_FORM_URLENCODED,
-                response.getType().toString());
+                response.getMediaType().toString());
 
         MultiValueMap<String, String> params =
                 UriComponentsBuilder.fromUri(location).build().getQueryParams();
@@ -212,17 +212,17 @@
     @Test
     public void testRequestAuthorizationCodeUnsupportedImplicitFlow ()
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("scope", "openid");
-        form.add("redirect_uri", redirectUri);
-        form.add("response_type", "id_token");
-        form.add("client_id", "fCBbQkAyYzI4NzUxMg");
-        form.add("nonce", "nonce");
+        Form form = new Form();
+        form.param("scope", "openid");
+        form.param("redirect_uri", redirectUri);
+        form.param("response_type", "id_token");
+        form.param("client_id", "fCBbQkAyYzI4NzUxMg");
+        form.param("nonce", "nonce");
 
         testRequestAuthorizationCodeUnsupportedResponseType(form, "id_token");
 
-        form.remove("response_type");
-        form.add("response_type", "id_token token");
+        form.asMap().remove("response_type");
+        form.param("response_type", "id_token token");
         testRequestAuthorizationCodeUnsupportedResponseType(form, "id_token");
     }
 
@@ -242,16 +242,16 @@
     @Test
     public void testRequestAuthorizationCodeUnsupportedHybridFlow ()
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("scope", "openid");
-        form.add("redirect_uri", redirectUri);
-        form.add("response_type", "code id_token");
-        form.add("client_id", "fCBbQkAyYzI4NzUxMg");
-        form.add("nonce", "nonce");
+        Form form = new Form();
+        form.param("scope", "openid");
+        form.param("redirect_uri", redirectUri);
+        form.param("response_type", "code id_token");
+        form.param("client_id", "fCBbQkAyYzI4NzUxMg");
+        form.param("nonce", "nonce");
         testRequestAuthorizationCodeUnsupportedResponseType(form, "id_token");
 
-        form.remove("response_type");
-        form.add("response_type", "code token");
+        form.asMap().remove("response_type");
+        form.param("response_type", "code token");
         testRequestAuthorizationCodeUnsupportedResponseType(form, "token");
     }
 
@@ -261,33 +261,33 @@
             NoSuchAlgorithmException, JOSEException {
         String client_id = "fCBbQkAyYzI4NzUxMg";
         String nonce = "thisIsMyNonce";
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("response_type", "code");
-        form.add("client_id", client_id);
-        form.add("redirect_uri", redirectUri);
-        form.add("scope", "openid");
-        form.add("state", "thisIsMyState");
-        form.add("nonce", nonce);
+        Form form = new Form();
+        form.param("response_type", "code");
+        form.param("client_id", client_id);
+        form.param("redirect_uri", redirectUri);
+        form.param("scope", "openid");
+        form.param("state", "thisIsMyState");
+        form.param("nonce", nonce);
 
-        ClientResponse response = sendAuthorizationRequest(form);
+        Response response = sendAuthorizationRequest(form);
         URI location = response.getLocation();
         MultiValueMap<String, String> params =
                 UriComponentsBuilder.fromUri(location).build().getQueryParams();
         assertEquals("thisIsMyState", params.getFirst("state"));
         String code = params.getFirst("code");
 
-        MultivaluedMap<String, String> tokenForm = new MultivaluedMapImpl();
+        Form tokenForm = new Form();
         testRequestAccessTokenMissingGrant(tokenForm);
-        tokenForm.add("grant_type", "authorization_code");
-        tokenForm.add("code", code);
+        tokenForm.param("grant_type", "authorization_code");
+        tokenForm.param("code", code);
         testRequestAccessTokenMissingClientId(tokenForm);
-        tokenForm.add("client_id", client_id);
+        tokenForm.param("client_id", client_id);
         testRequestAccessTokenMissingClientSecret(tokenForm);
-        tokenForm.add("client_secret", "secret");
-        tokenForm.add("redirect_uri", redirectUri);
+        tokenForm.param("client_secret", "secret");
+        tokenForm.param("redirect_uri", redirectUri);
 
-        ClientResponse tokenResponse = sendTokenRequest(tokenForm);
-        String entity = tokenResponse.getEntity(String.class);
+        Response tokenResponse = sendTokenRequest(tokenForm);
+        String entity = tokenResponse.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node.at("/access_token").asText());
@@ -302,9 +302,9 @@
     }
 
     private void testRequestAccessTokenMissingGrant (
-            MultivaluedMap<String, String> tokenForm) throws KustvaktException {
-        ClientResponse response = sendTokenRequest(tokenForm);
-        String entity = response.getEntity(String.class);
+            Form tokenForm) throws KustvaktException {
+        Response response = sendTokenRequest(tokenForm);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
         assertEquals("Invalid request: Missing grant_type parameter",
@@ -312,9 +312,9 @@
     }
 
     private void testRequestAccessTokenMissingClientId (
-            MultivaluedMap<String, String> tokenForm) throws KustvaktException {
-        ClientResponse response = sendTokenRequest(tokenForm);
-        String entity = response.getEntity(String.class);
+            Form tokenForm) throws KustvaktException {
+        Response response = sendTokenRequest(tokenForm);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
         assertEquals("Invalid request: Missing required client_id "
@@ -322,9 +322,9 @@
     }
 
     private void testRequestAccessTokenMissingClientSecret (
-            MultivaluedMap<String, String> tokenForm) throws KustvaktException {
-        ClientResponse response = sendTokenRequest(tokenForm);
-        String entity = response.getEntity(String.class);
+            Form tokenForm) throws KustvaktException {
+        Response response = sendTokenRequest(tokenForm);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
         assertEquals("Missing parameter: client_secret",
@@ -357,20 +357,20 @@
             NoSuchAlgorithmException, JOSEException {
         // public client
         String client_id = "8bIDtZnH6NvRkW2Fq";
-        MultivaluedMap<String, String> tokenForm = new MultivaluedMapImpl();
+        Form tokenForm = new Form();
         testRequestAccessTokenMissingGrant(tokenForm);
 
-        tokenForm.add("grant_type", GrantType.PASSWORD.toString());
+        tokenForm.param("grant_type", GrantType.PASSWORD.toString());
         testRequestAccessTokenMissingUsername(tokenForm);
 
-        tokenForm.add("username", username);
+        tokenForm.param("username", username);
         testRequestAccessTokenMissingPassword(tokenForm);
 
-        tokenForm.add("password", "pass");
-        tokenForm.add("client_id", client_id);
+        tokenForm.param("password", "pass");
+        tokenForm.param("client_id", client_id);
 
-        ClientResponse tokenResponse = sendTokenRequest(tokenForm);
-        String entity = tokenResponse.getEntity(String.class);
+        Response tokenResponse = sendTokenRequest(tokenForm);
+        String entity = tokenResponse.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(OAuth2Error.UNAUTHORIZED_CLIENT,
@@ -380,9 +380,9 @@
     }
 
     private void testRequestAccessTokenMissingUsername (
-            MultivaluedMap<String, String> tokenForm) throws KustvaktException {
-        ClientResponse response = sendTokenRequest(tokenForm);
-        String entity = response.getEntity(String.class);
+            Form tokenForm) throws KustvaktException {
+        Response response = sendTokenRequest(tokenForm);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
         assertEquals("Invalid request: Missing or empty username parameter",
@@ -390,9 +390,9 @@
     }
 
     private void testRequestAccessTokenMissingPassword (
-            MultivaluedMap<String, String> tokenForm) throws KustvaktException {
-        ClientResponse response = sendTokenRequest(tokenForm);
-        String entity = response.getEntity(String.class);
+            Form tokenForm) throws KustvaktException {
+        Response response = sendTokenRequest(tokenForm);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
         assertEquals("Invalid request: Missing or empty password parameter",
@@ -401,11 +401,11 @@
 
     @Test
     public void testPublicKeyAPI () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("oauth2").path("openid")
+        Response response = target().path(API_VERSION).path("oauth2").path("openid")
                 .path("jwks")
                 .request()
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(1, node.at("/keys").size());
         node = node.at("/keys/0");
@@ -417,11 +417,11 @@
 
     @Test
     public void testOpenIDConfiguration () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("oauth2").path("openid")
+        Response response = target().path(API_VERSION).path("oauth2").path("openid")
                 .path("config")
                 .request()
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node.at("/issuer"));
         assertNotNull(node.at("/authorization_endpoint"));
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
index bbc6cf7..c1cecb8 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2PluginTest.java
@@ -7,7 +7,8 @@
 
 import java.io.IOException;
 
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
 
 import org.apache.http.entity.ContentType;
 import org.junit.Test;
@@ -16,10 +17,10 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.client.Entity;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -54,9 +55,9 @@
         json.setSource(source);
         json.setRefreshTokenExpiry(refreshTokenExpiry);
 
-        ClientResponse response = registerClient(username, json);
+        Response response = registerClient(username, json);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         String clientId = node.at("/client_id").asText();
         String clientSecret = node.at("/client_secret").asText();
         assertNotNull(clientId);
@@ -85,8 +86,8 @@
         json.setDescription("This is a public plugin.");
         json.setSource(source);
 
-        ClientResponse response = registerClient(username, json);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        Response response = registerClient(username, json);
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
 
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
         assertEquals(OAuth2Error.INVALID_REQUEST, node.at("/error").asText());
@@ -139,8 +140,8 @@
     public void testListPluginsUnauthorizedPublic ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("super_client_id", publicClientId);
+        Form form = new Form();
+        form.param("super_client_id", publicClientId);
         testListPluginsClientUnauthorized(form);
     }
 
@@ -148,9 +149,9 @@
     public void testListPluginsUnauthorizedConfidential ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("super_client_id", confidentialClientId2);
-        form.add("super_client_secret", clientSecret);
+        Form form = new Form();
+        form.param("super_client_id", confidentialClientId2);
+        form.param("super_client_secret", clientSecret);
         testListPluginsClientUnauthorized(form);
     }
 
@@ -158,18 +159,18 @@
     public void testListPluginsMissingClientSecret ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("super_client_id", confidentialClientId);
+        Form form = new Form();
+        form.param("super_client_id", confidentialClientId);
 
-        ClientResponse response = resource().path(API_VERSION).path("plugins")
+        Response response = target().path(API_VERSION).path("plugins")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
@@ -179,18 +180,18 @@
     }
 
     private void testListPluginsClientUnauthorized (
-            MultivaluedMap<String, String> form)
+            Form form)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("plugins")
+        Response response = target().path(API_VERSION).path("plugins")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -205,14 +206,15 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("plugins")
+        Form form = getSuperClientForm();
+        Response response = target().path(API_VERSION).path("plugins")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer blahblah")
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(getSuperClientForm()).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -241,32 +243,32 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        MultivaluedMap<String, String> form = getSuperClientForm();
+        Form form = getSuperClientForm();
         if (permitted_only) {
-            form.add("permitted_only", Boolean.toString(permitted_only));
+            form.param("permitted_only", Boolean.toString(permitted_only));
         }
-        ClientResponse response = resource().path(API_VERSION).path("plugins")
+        Response response = target().path(API_VERSION).path("plugins")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
 
     private void testInstallConfidentialPlugin (String superClientId,
             String clientId, String username) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        form.add("client_id", clientId);
-        ClientResponse response = installPlugin(form);
+        Form form = getSuperClientForm();
+        form.param("client_id", clientId);
+        Response response = installPlugin(form);
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(clientId, node.at("/client_id").asText());
         assertEquals(superClientId, node.at("/super_client_id").asText());
@@ -284,11 +286,11 @@
     @Test
     public void testInstallPublicPlugin () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        form.add("client_id", publicClientId2);
-        ClientResponse response = installPlugin(form);
+        Form form = getSuperClientForm();
+        form.param("client_id", publicClientId2);
+        Response response = installPlugin(form);
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(publicClientId2, node.at("/client_id").asText());
         assertEquals(superClientId, node.at("/super_client_id").asText());
@@ -311,11 +313,11 @@
     }
 
     private void testInstallPluginRedundant (
-            MultivaluedMap<String, String> form)
+            Form form)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = installPlugin(form);
-        String entity = response.getEntity(String.class);
+        Response response = installPlugin(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.PLUGIN_HAS_BEEN_INSTALLED,
                 node.at("/errors/0/0").asInt());
@@ -325,10 +327,10 @@
     private void testInstallPluginNotPermitted (String clientId)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        form.add("client_id", clientId);
-        ClientResponse response = installPlugin(form);
-        String entity = response.getEntity(String.class);
+        Form form = getSuperClientForm();
+        form.param("client_id", clientId);
+        Response response = installPlugin(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.PLUGIN_NOT_PERMITTED,
                 node.at("/errors/0/0").asInt());
@@ -339,9 +341,9 @@
     public void testInstallPluginMissingClientId ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        ClientResponse response = installPlugin(form);
-        String entity = response.getEntity(String.class);
+        Form form = getSuperClientForm();
+        Response response = installPlugin(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.INVALID_ARGUMENT,
                 node.at("/errors/0/0").asInt());
@@ -352,10 +354,10 @@
     public void testInstallPluginInvalidClientId ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        form.add("client_id", "unknown");
-        ClientResponse response = installPlugin(form);
-        String entity = response.getEntity(String.class);
+        Form form = getSuperClientForm();
+        form.param("client_id", "unknown");
+        Response response = installPlugin(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals("Unknown client: unknown",
                 node.at("/error_description").asText());
@@ -367,11 +369,11 @@
     public void testInstallPluginMissingSuperClientSecret ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("super_client_id", superClientId);
+        Form form = new Form();
+        form.param("super_client_id", superClientId);
 
-        ClientResponse response = installPlugin(form);
-        String entity = response.getEntity(String.class);
+        Response response = installPlugin(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals("Missing parameter: super_client_secret",
@@ -385,9 +387,9 @@
     public void testInstallPluginMissingSuperClientId ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        ClientResponse response = installPlugin(form);
-        String entity = response.getEntity(String.class);
+        Form form = new Form();
+        Response response = installPlugin(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals("Missing parameter: super_client_id",
@@ -401,44 +403,44 @@
     public void testInstallPluginUnauthorizedClient ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("super_client_id", confidentialClientId);
-        form.add("super_client_secret", clientSecret);
+        Form form = new Form();
+        form.param("super_client_id", confidentialClientId);
+        form.param("super_client_secret", clientSecret);
 
-        ClientResponse response = installPlugin(form);
-        String entity = response.getEntity(String.class);
+        Response response = installPlugin(form);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals("unauthorized_client", node.at("/error").asText());
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
     }
 
-    private ClientResponse installPlugin (MultivaluedMap<String, String> form)
+    private Response installPlugin (Form form)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        return resource().path(API_VERSION).path("plugins").path("install")
+        return target().path(API_VERSION).path("plugins").path("install")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
     }
 
-    private ClientResponse uninstallPlugin (String clientId, String username)
+    private Response uninstallPlugin (String clientId, String username)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        form.add("client_id", clientId);
+        Form form = getSuperClientForm();
+        form.param("client_id", clientId);
 
-        return resource().path(API_VERSION).path("plugins").path("uninstall")
+        return target().path(API_VERSION).path("plugins").path("uninstall")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
     }
 
     private void testRetrieveInstalledPlugin (String superClientId,
@@ -472,7 +474,7 @@
         node = retrieveUserInstalledPlugin(getSuperClientForm());
         assertEquals(2, node.size());
 
-        ClientResponse response =
+        Response response =
                 uninstallPlugin(confidentialClientId, username);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         node = retrieveUserInstalledPlugin(getSuperClientForm());
@@ -494,9 +496,9 @@
         String userAuthHeader = HttpAuthorizationHandler
                 .createBasicAuthorizationHeaderValue(username, "password");
         String code = requestAuthorizationCode(clientId, userAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 clientId, clientSecret, code);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         return node;
@@ -505,29 +507,29 @@
     private void testUninstallNotInstalledPlugin ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response =
+        Response response =
                 uninstallPlugin(confidentialClientId2, username);
         assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
 
     }
 
     private JsonNode retrieveUserInstalledPlugin (
-            MultivaluedMap<String, String> form)
+            Form form)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("plugins")
+        Response response = target().path(API_VERSION).path("plugins")
                 .path("installed")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
 
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
index 452066c..d1bd166 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2TestBase.java
@@ -7,6 +7,8 @@
 import java.io.IOException;
 import java.net.URI;
 
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response.Status;
 
@@ -20,11 +22,12 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.uri.UriComponent;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+
+import org.glassfish.jersey.uri.UriComponent;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -71,19 +74,19 @@
         return UriComponent.decodeQuery(uri, true);
     };
 
-    protected MultivaluedMap<String, String> getSuperClientForm () {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("super_client_id", superClientId);
-        form.add("super_client_secret", clientSecret);
+    protected Form getSuperClientForm () {
+        Form form = new Form();
+        form.param("super_client_id", superClientId);
+        form.param("super_client_secret", clientSecret);
         return form;
     }
 
-    protected ClientResponse requestAuthorizationCode (String responseType,
+    protected Response requestAuthorizationCode (String responseType,
             String clientId, String redirectUri, String scope, String state,
             String authHeader) throws KustvaktException {
 
-        WebResource request =
-                resource().path(API_VERSION).path("oauth2").path("authorize");
+        WebTarget request =
+                target().path(API_VERSION).path("oauth2").path("authorize");
         
         if (!responseType.isEmpty()) {
             request = request.queryParam("response_type", responseType);
@@ -102,13 +105,13 @@
         }
         
         return request.request().header(Attributes.AUTHORIZATION, authHeader)
-                .get(ClientResponse.class);
+                .get();
     }
 
     protected String requestAuthorizationCode (String clientId,
             String authHeader) throws KustvaktException {
 
-        ClientResponse response = requestAuthorizationCode("code", clientId, "",
+        Response response = requestAuthorizationCode("code", clientId, "",
                 "", "", authHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
                 response.getStatus());
@@ -121,7 +124,7 @@
 
     protected String requestAuthorizationCode (String clientId,
             String redirect_uri, String authHeader) throws KustvaktException {
-        ClientResponse response = requestAuthorizationCode("code", clientId,
+        Response response = requestAuthorizationCode("code", clientId,
                 redirect_uri, "", "", authHeader);
         assertEquals(Status.TEMPORARY_REDIRECT.getStatusCode(),
                 response.getStatus());
@@ -132,124 +135,124 @@
         return params.getFirst("code");
     }
 
-    protected ClientResponse requestToken (MultivaluedMap<String, String> form)
+    protected Response requestToken (Form form)
             throws KustvaktException {
-        return resource().path(API_VERSION).path("oauth2").path("token")
+        return target().path(API_VERSION).path("oauth2").path("token")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+               .post(Entity.form(form));
     }
 
     // client credentials as form params
-    protected ClientResponse requestTokenWithAuthorizationCodeAndForm (
+    protected Response requestTokenWithAuthorizationCodeAndForm (
             String clientId, String clientSecret, String code)
             throws KustvaktException {
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "authorization_code");
-        form.add("client_id", clientId);
-        form.add("client_secret", clientSecret);
-        form.add("code", code);
+        Form form = new Form();
+        form.param("grant_type", "authorization_code");
+        form.param("client_id", clientId);
+        form.param("client_secret", clientSecret);
+        form.param("code", code);
 
-        return resource().path(API_VERSION).path("oauth2").path("token")
+        return target().path(API_VERSION).path("oauth2").path("token")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
     }
 
-    protected ClientResponse requestTokenWithAuthorizationCodeAndForm (
+    protected Response requestTokenWithAuthorizationCodeAndForm (
             String clientId, String clientSecret, String code,
             String redirectUri) throws KustvaktException {
 
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "authorization_code");
-        form.add("client_id", clientId);
-        form.add("client_secret", clientSecret);
-        form.add("code", code);
+        Form form = new Form();
+        form.param("grant_type", "authorization_code");
+        form.param("client_id", clientId);
+        form.param("client_secret", clientSecret);
+        form.param("code", code);
         if (redirectUri != null) {
-            form.add("redirect_uri", redirectUri);
+            form.param("redirect_uri", redirectUri);
         }
 
-        return resource().path(API_VERSION).path("oauth2").path("token")
+        return target().path(API_VERSION).path("oauth2").path("token")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
     }
 
     // client credentials in authorization header
     protected JsonNode requestTokenWithAuthorizationCodeAndHeader (
             String clientId, String code, String authHeader)
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "authorization_code");
-        form.add("client_id", clientId);
-        form.add("code", code);
+        Form form = new Form();
+        form.param("grant_type", "authorization_code");
+        form.param("client_id", clientId);
+        form.param("code", code);
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("token")
                 .request()
                 .header(Attributes.AUTHORIZATION, authHeader)
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
 
-    protected ClientResponse requestTokenWithDoryPassword (String clientId,
+    protected Response requestTokenWithDoryPassword (String clientId,
             String clientSecret) throws KustvaktException {
         return requestTokenWithPassword(clientId, clientSecret, "dory",
                 "password");
     }
 
-    protected ClientResponse requestTokenWithPassword (String clientId,
+    protected Response requestTokenWithPassword (String clientId,
             String clientSecret, String username, String password)
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "password");
-        form.add("client_id", clientId);
-        form.add("client_secret", clientSecret);
-        form.add("username", username);
-        form.add("password", password);
+        Form form = new Form();
+        form.param("grant_type", "password");
+        form.param("client_id", clientId);
+        form.param("client_secret", clientSecret);
+        form.param("username", username);
+        form.param("password", password);
 
         return requestToken(form);
     }
 
     protected void testRequestTokenWithRevokedRefreshToken (String clientId,
             String clientSecret, String refreshToken) throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", GrantType.REFRESH_TOKEN.toString());
-        form.add("client_id", clientId);
-        form.add("client_secret", clientSecret);
-        form.add("refresh_token", refreshToken);
+        Form form = new Form();
+        form.param("grant_type", GrantType.REFRESH_TOKEN.toString());
+        form.param("client_id", clientId);
+        form.param("client_secret", clientSecret);
+        form.param("refresh_token", refreshToken);
         if (clientSecret != null) {
-            form.add("client_secret", clientSecret);
+            form.param("client_secret", clientSecret);
         }
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("token")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("token")
                         .request()
                         .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
+                        .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(OAuth2Error.INVALID_GRANT, node.at("/error").asText());
         assertEquals("Refresh token has been revoked",
                 node.at("/error_description").asText());
     }
 
-    protected ClientResponse registerClient (String username,
+    protected Response registerClient (String username,
             OAuth2ClientJson json) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        return resource().path(API_VERSION).path("oauth2").path("client")
+        return target().path(API_VERSION).path("oauth2").path("client")
                 .path("register")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -258,10 +261,10 @@
                                         "password"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).post(ClientResponse.class);
+                .post(Entity.json(json));
     }
 
-    protected ClientResponse registerConfidentialClient (String username)
+    protected Response registerConfidentialClient (String username)
             throws KustvaktException {
 
         OAuth2ClientJson json = new OAuth2ClientJson();
@@ -300,12 +303,12 @@
             String clientId) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("deregister").path(clientId)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
     }
@@ -313,33 +316,33 @@
     protected JsonNode retrieveClientInfo (String clientId, String username)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path(clientId)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
 
-    protected ClientResponse searchWithAccessToken (String accessToken) {
-        return resource().path(API_VERSION).path("search")
+    protected Response searchWithAccessToken (String accessToken) {
+        return target().path(API_VERSION).path("search")
                 .queryParam("q", "Wasser").queryParam("ql", "poliqarp")
                 .request()
                 .header(Attributes.AUTHORIZATION, "Bearer " + accessToken)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
     }
     
     protected void testSearchWithOAuth2Token (String accessToken)
             throws KustvaktException, IOException {
-        ClientResponse response = searchWithAccessToken(accessToken);
-        String entity = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = searchWithAccessToken(accessToken);
+        String entity = response.readEntity(String.class);
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         assertNotNull(node);
@@ -348,9 +351,9 @@
     
     protected void testSearchWithRevokedAccessToken (String accessToken)
             throws KustvaktException {
-        ClientResponse response = searchWithAccessToken(accessToken);
-        String entity = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        Response response = searchWithAccessToken(accessToken);
+        String entity = response.readEntity(String.class);
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -363,59 +366,60 @@
 
     protected void testRevokeTokenViaSuperClient (String token,
             String userAuthHeader) {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("token", token);
-        form.add("super_client_id", superClientId);
-        form.add("super_client_secret", clientSecret);
+        Form form = new Form();
+        form.param("token", token);
+        form.param("super_client_id", superClientId);
+        form.param("super_client_secret", clientSecret);
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("revoke").path("super")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .header(Attributes.AUTHORIZATION, userAuthHeader).entity(form)
-                .post(ClientResponse.class);
+                .header(Attributes.AUTHORIZATION, userAuthHeader)
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        assertEquals("SUCCESS", response.getEntity(String.class));
+        assertEquals("SUCCESS", response.readEntity(String.class));
     }
 
     protected void testRevokeToken (String token, String clientId,
             String clientSecret, String tokenType) {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("token_type", tokenType);
-        form.add("token", token);
-        form.add("client_id", clientId);
+        Form form = new Form();
+        form.param("token_type", tokenType);
+        form.param("token", token);
+        form.param("client_id", clientId);
         if (clientSecret != null) {
-            form.add("client_secret", clientSecret);
+            form.param("client_secret", clientSecret);
         }
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("revoke")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("revoke")
                         .request()
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
+                        .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        assertEquals("SUCCESS", response.getEntity(String.class));
+        assertEquals("SUCCESS", response.readEntity(String.class));
     }
 
     protected JsonNode listUserRegisteredClients (String username)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Form form = getSuperClientForm();
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("list")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pwd"))
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(getSuperClientForm()).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
     
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
index d8c67a5..9b256c7 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceControllerTest.java
@@ -8,9 +8,10 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 import com.sun.jersey.api.client.UniformInterfaceException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.client.Entity;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -31,13 +32,13 @@
             String queryCreator, String username, ResourceType resourceType,
             CorpusAccess access) throws KustvaktException {
         
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~" + queryCreator).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         
@@ -58,13 +59,13 @@
         String json = "{\"query\": \"Sonne\""
                 + ",\"queryLanguage\": \"poliqarp\"}";
         
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~"+qCreator).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
         
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
         
@@ -79,13 +80,13 @@
                 + ",\"query\": \"der\"}";
 
         String qName = "new_query";
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~" + testUser).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -104,13 +105,13 @@
                 + ",\"query\": \"Regen\"}";
 
         String qName = "publish_query";
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~" + testUser).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -129,13 +130,13 @@
                 + ",\"query\": \"Sommer\"}";
 
         String qName = "marlin-query";
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~marlin").path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
         
@@ -153,13 +154,13 @@
                 + ",\"query\": \"Sommer\"}";
 
         String qName = "system-query";
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~system").path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
         
@@ -176,17 +177,17 @@
                 + ",\"queryLanguage\": \"poliqarp\"" 
                 + ",\"query\": \"Sommer\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~"+testUser).path("system-query")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -201,13 +202,13 @@
                 + ",\"query\": \"Sohn\"}";
 
         String qName = "new_query";
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~" + testUser).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -223,17 +224,17 @@
                 + ",\"query\": \"Sohn\"}";
 
         String qName = "new_query";
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~" + testUser).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         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("queryLanguage is null", node.at("/errors/0/1").asText());
@@ -247,17 +248,17 @@
                 + ",\"queryLanguage\": \"poliqarp\"}";
 
         String qName = "new_query";
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~" + testUser).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         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("query is null", node.at("/errors/0/1").asText());
@@ -270,17 +271,17 @@
                 + ",\"queryLanguage\": \"poliqarp\"}";
 
         String qName = "new_query";
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~" + testUser).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         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("type is null", node.at("/errors/0/1").asText());
@@ -289,26 +290,26 @@
     
     private void testDeleteQueryByName (String qName, String qCreator, String username)
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~" + qCreator).path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
     }
     
     @Test
     public void testDeleteQueryUnauthorized () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~dory").path("dory-q")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -319,14 +320,14 @@
     }
     
     private void testDeleteSystemQueryUnauthorized (String qName) throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~system").path(qName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -338,16 +339,16 @@
     
     @Test
     public void testDeleteNonExistingQuery () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .path("~dory").path("non-existing-query")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
         
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
@@ -386,16 +387,16 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("query")
+        Response response = target().path(API_VERSION).path("query")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         return node;
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceSearchTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceSearchTest.java
index 8732aef..00a8077 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceSearchTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/QueryReferenceSearchTest.java
@@ -5,7 +5,7 @@
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.utils.JsonUtils;
@@ -14,12 +14,12 @@
 
     /*@Test
     public void testSearchWithVCRefEqual () 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("cq", "referTo \"dory/dory-q\"")
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertTrue(node.at("/matches").size() > 0);
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
index 2d872ee..87fd5bd 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/QuerySerializationControllerTest.java
@@ -12,11 +12,14 @@
 
 import java.util.Iterator;
 
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Response.Status;
+
 import org.junit.Ignore;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -32,15 +35,15 @@
     @Test
     public void testQuerySerializationFilteredPublic ()
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
 
                 .path("corpus/WPD13/query").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("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("corpusSigle", node.at("/collection/key").asText());
@@ -52,14 +55,14 @@
     @Test
     public void testQuerySerializationUnexistingResource ()
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("corpus/ZUW19/query")
+        Response response = target().path(API_VERSION).path("corpus/ZUW19/query")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
                 .queryParam("context", "base/s:s")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .method("GET");
+        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(101, node.at("/errors/0/0").asInt());
         assertEquals("[Cannot found public Corpus with ids: [ZUW19]]",
@@ -70,15 +73,15 @@
     @Test
     public void testQuerySerializationWithNonPublicCorpus ()
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
 
                 .path("corpus/BRZ10/query").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .method("GET");
+        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(101, node.at("/errors/0/0").asInt());
         assertEquals("[Cannot found public Corpus with ids: [BRZ10]]",
@@ -89,7 +92,7 @@
     @Test
     public void testQuerySerializationWithAuthentication ()
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
 
                 .path("corpus/BRZ10/query").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp")
@@ -98,10 +101,10 @@
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("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("koral:doc", node.at("/collection/@type").asText());
@@ -114,7 +117,7 @@
     public void testQuerySerializationWithNewCollection ()
             throws KustvaktException {
         // Add Virtual Collection
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
 
                 .path("virtualcollection").queryParam("filter", "false")
                 .queryParam("query",
@@ -126,19 +129,19 @@
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .post(ClientResponse.class);
+                .post(Entity.json(""));
 
-        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);
         assertNotNull(node);
         assertTrue(node.isObject());
         assertEquals("Weimarer Werke", node.path("name").asText());
 
         // Get virtual collections
-        response = resource().path(API_VERSION)
+        response = target().path(API_VERSION)
 
                 .path("collection")
                 .request()
@@ -146,10 +149,10 @@
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        ent = response.getEntity(String.class);
+        ent = response.readEntity(String.class);
         node = JsonUtils.readTree(ent);
         assertNotNull(node);
 
@@ -164,7 +167,7 @@
         assertFalse(id.isEmpty());
 
         // query serialization service
-        response = resource().path(API_VERSION)
+        response = target().path(API_VERSION)
 
                 .path("collection").path(id).path("query")
                 .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
@@ -174,10 +177,10 @@
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
-        ent = response.getEntity(String.class);
+        ent = response.readEntity(String.class);
         node = JsonUtils.readTree(ent);
         assertNotNull(node);
 //        System.out.println("NODE " + ent);
@@ -205,15 +208,15 @@
     @Test
     public void testQuerySerializationOfVirtualCollection ()
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
 
                 .path("collection/GOE-VC/query").queryParam("q", "[orth=der]")
                 .queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
                 .request()
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .method("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("koral:doc",
@@ -233,18 +236,18 @@
 
     @Test
     public void testMetaQuerySerialization () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
 
                 .path("query").queryParam("context", "sentence")
                 .queryParam("count", "20").queryParam("page", "5")
                 .queryParam("cutoff", "true").queryParam("q", "[pos=ADJA]")
                 .queryParam("ql", "poliqarp")
                 .request()
-                .method("GET", ClientResponse.class);
+                .method("GET");
         assertEquals(response.getStatus(),
-                ClientResponse.Status.OK.getStatusCode());
+                Status.OK.getStatusCode());
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
 
         assertEquals("sentence", node.at("/meta/context").asText());
@@ -262,18 +265,18 @@
     @Test
     public void testMetaQuerySerializationWithOffset ()
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
 
                 .path("query").queryParam("context", "sentence")
                 .queryParam("count", "20").queryParam("page", "5")
                 .queryParam("offset", "2").queryParam("cutoff", "true")
                 .queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
                 .request()
-                .method("GET", ClientResponse.class);
+                .method("GET");
         assertEquals(response.getStatus(),
-                ClientResponse.Status.OK.getStatusCode());
+                Status.OK.getStatusCode());
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
 
         assertEquals("sentence", node.at("/meta/context").asText());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
index 11e8976..53a9957 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/ResourceInfoControllerTest.java
@@ -5,11 +5,13 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import javax.ws.rs.core.Response.Status;
+
 import org.junit.Ignore;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -27,13 +29,13 @@
 
     @Test
     public void testGetPublicVirtualCollectionInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("collection")
                 .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);
         assertNotNull(node);
         assertEquals(1, node.size());
@@ -43,18 +45,18 @@
     @Test
     public void testGetVirtualCollectionInfoWithAuthentication ()
             throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("collection")
                 .request()
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertNotNull(node);
         assertTrue(node.isArray());
         assertEquals(3, node.size());
@@ -63,13 +65,13 @@
 
     @Test
     public void testGetVirtualCollectionInfoById () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("collection").path("GOE-VC")
                 .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);
         assertNotEquals(0, node.size());
@@ -81,13 +83,13 @@
     @Test
     public void testGetVirtualCollectionInfoByIdUnauthorized ()
             throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("collection").path("WPD15-VC")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .get();
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertNotEquals(0, node.size());
@@ -99,13 +101,13 @@
 
     @Test
     public void testGetPublicCorporaInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("corpus")
                 .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);
         assertTrue(node.isArray());
@@ -115,14 +117,14 @@
 
     @Test
     public void testGetCorpusInfoById () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("corpus").path("WPD13")
                 .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);
         // System.out.println(ent);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
@@ -133,13 +135,13 @@
 
     @Test
     public void testGetCorpusInfoById2 () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("corpus").path("GOE")
                 .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);
         assertTrue(node.isObject());
@@ -149,13 +151,13 @@
 
     @Test
     public void testGetPublicFoundriesInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("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);
         assertTrue(node.isArray());
@@ -165,12 +167,12 @@
 
     @Test
     public void testGetFoundryInfoById () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("foundry").path("tt")
                 .request()
-                .get(ClientResponse.class);
-        String ent = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        String ent = response.readEntity(String.class);
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(ent);
@@ -181,13 +183,13 @@
 
     @Test
     public void testGetUnexistingCorpusInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("corpus").path("ZUW19")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .get();
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertNotEquals(0, node.size());
@@ -203,13 +205,13 @@
     // exception instead?
     @Test
     public void testGetUnauthorizedCorpusInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
+        Response response = target().path(getAPIVersion())
                 .path("corpus").path("BRZ10")
                 .request()
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .get();
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertNotEquals(0, node.size());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
index facf1b0..968861f 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchControllerTest.java
@@ -6,7 +6,9 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response.Status;
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import org.junit.Ignore;
@@ -14,7 +16,7 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -36,15 +38,15 @@
     private KustvaktConfiguration config;
 
     private JsonNode requestSearchWithFields(String fields) 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", fields)
                 .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);
         return node;
     }
@@ -59,17 +61,17 @@
 
     @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());
         assertEquals(
             "Wes8Bd4h1OypPqbWF5njeQ==",
             response.getHeaders().getFirst("X-Index-Revision")
             );
 
-        String message = response.getEntity(String.class);
+        String message = response.readEntity(String.class);
         assertEquals(message, config.getApiWelcomeMessage());
     }
 
@@ -91,13 +93,13 @@
     
     @Test
     public void testSearchQueryPublicCorpora () 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")
                 .request()
-                .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .accept(MediaType.APPLICATION_JSON).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("koral:doc", node.at("/collection/@type").asText());
@@ -111,17 +113,17 @@
 
     @Test
     public void testSearchQueryFailure () 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("cq", "corpusSigle=WPD | corpusSigle=GOE")
                 .queryParam("count", "13")
                 .request()
                 .accept(MediaType.APPLICATION_JSON)
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .get();
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertEquals(302, node.at("/errors/0/0").asInt());
@@ -133,15 +135,15 @@
 
     @Test
     public void testSearchQueryWithMeta () 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("cutoff", "true").queryParam("count", "5")
                 .queryParam("page", "1").queryParam("context", "40-t,30-t")
                 .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);
         assertTrue(node.at("/meta/cutOff").asBoolean());
@@ -155,14 +157,14 @@
 
     @Test
     public void testSearchQueryFreeExtern () 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")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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);
         assertNotNull(node);
         assertNotEquals(0, node.path("matches").size());
@@ -177,14 +179,14 @@
 
     @Test
     public void testSearchQueryFreeIntern () 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")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "172.27.0.32")
-                .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);
         assertNotNull(node);
         assertNotEquals(0, node.path("matches").size());
@@ -199,7 +201,7 @@
 
     @Test
     public void testSearchQueryExternAuthorized () 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")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -207,10 +209,10 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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);
         // System.out.println(entity);
         assertNotNull(node);
@@ -231,7 +233,7 @@
 
     @Test
     public void testSearchQueryInternAuthorized () 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")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -239,10 +241,10 @@
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "172.27.0.32")
-                .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);
         assertNotNull(node);
         assertNotEquals(0, node.path("matches").size());
@@ -268,7 +270,7 @@
     @Test
     public void testSearchQueryWithCollectionQueryAuthorizedWithoutIP ()
             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", "textClass=politik & corpusSigle=BRZ10")
                 .request()
@@ -276,11 +278,11 @@
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .get();
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertNotNull(node);
         assertEquals("operation:insertion",
                 node.at("/collection/rewrites/0/operation").asText());
@@ -300,17 +302,17 @@
     @Test
     @Ignore
     public void testSearchQueryAuthorizedWithoutIP () 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")
                 .request()
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .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);
         assertNotNull(node);
         assertNotEquals(0, node.path("matches").size());
@@ -325,14 +327,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());
@@ -340,14 +342,14 @@
 
     @Test
     public void testSearchSentenceMeta () 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("context", "sentence")
                 .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("base/s:s", node.at("/meta/context").asText());
@@ -361,12 +363,12 @@
         QuerySerializer s = new QuerySerializer();
         s.setQuery("(der) or (das)", "CQL");
 
-        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 ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
@@ -378,12 +380,12 @@
     @Test
     @Ignore
     public void testSearchRawQuery () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .request()
-                .post(ClientResponse.class, createJsonQuery());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .post(Entity.json(createJsonQuery()));
+        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);
@@ -397,17 +399,17 @@
     @Test
     @Ignore
     public void testSearchPostAll () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "10.27.0.32")
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .post(ClientResponse.class, createJsonQuery());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .post(Entity.json(createJsonQuery()));
+        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);
@@ -421,17 +423,17 @@
     @Test
     @Ignore
     public void testSearchPostPublic () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
+        Response response = target().path(API_VERSION).path("search")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue("kustvakt",
                                         "kustvakt2015"))
-                .post(ClientResponse.class, createJsonQuery());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .post(Entity.json(createJsonQuery()));
+        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);
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchNetworkEndpointTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchNetworkEndpointTest.java
index 51c3eab..f35260a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchNetworkEndpointTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchNetworkEndpointTest.java
@@ -9,6 +9,8 @@
 import java.net.URISyntaxException;
 import java.nio.charset.StandardCharsets;
 
+import javax.ws.rs.core.Response.Status;
+
 import org.apache.commons.io.IOUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -19,7 +21,7 @@
 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 de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.config.SpringJerseyTest;
@@ -75,16 +77,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 +97,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 +115,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());
     }
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
index 3940708..10149d3 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPipeTest.java
@@ -16,6 +16,8 @@
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 
+import javax.ws.rs.core.Response.Status;
+
 import org.apache.commons.io.IOUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -25,7 +27,7 @@
 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 de.ids_mannheim.korap.config.SpringJerseyTest;
 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());
@@ -159,13 +161,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());
     }
@@ -185,16 +187,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());
     }
@@ -203,16 +205,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());
@@ -221,16 +223,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());
@@ -245,14 +247,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);
@@ -264,17 +266,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());
@@ -301,14 +303,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);
@@ -327,14 +329,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);
@@ -357,30 +359,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/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
index def3be9..7281f28 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchPublicMetadataTest.java
@@ -3,12 +3,15 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Response.Status;
+
 import org.junit.Ignore;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -21,14 +24,14 @@
 
     @Test
     public void testSearchPublicMetadata () 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("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("availability(ALL)",
@@ -39,15 +42,15 @@
 
     @Test
     public void testSearchPublicMetadataExtern () 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("access-rewrite-disabled", "true")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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("availability(ALL)",
@@ -58,15 +61,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);
 
         assertEquals("availability(ALL)",
@@ -82,15 +85,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,
@@ -114,12 +117,12 @@
         meta.addEntry("snippets", "true");
         s.setMeta(meta);
         
-        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 ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals("availability(ALL)",
@@ -131,15 +134,15 @@
     public void testSearchPublicMetadataWithSystemVC ()
             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("cq", "referTo system-vc")
                 .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("operation:and",
@@ -166,14 +169,14 @@
     @Test
     public void testSearchPublicMetadataWithPrivateVC ()
             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("cq", "referTo \"dory/dory-vc\"")
                 .queryParam("access-rewrite-disabled", "true")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchTokenSnippetTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchTokenSnippetTest.java
index 49a5b9d..bfebdf0 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchTokenSnippetTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/SearchTokenSnippetTest.java
@@ -4,10 +4,12 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+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 javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 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/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java
index 6e8e0e4..1259041 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/ShibbolethUserControllerTest.java
@@ -10,8 +10,11 @@
 import java.util.HashMap;
 import java.util.Map;
 
+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.Status;
 
 import org.apache.commons.collections.map.LinkedMap;
 import org.junit.Ignore;
@@ -21,8 +24,7 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.nimbusds.jose.JOSEException;
 import com.nimbusds.jwt.SignedJWT;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -52,10 +54,10 @@
 	@Test
 	public void loginHTTP() throws KustvaktException {
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("user").path("info")
+		Response response = target().path("user").path("info")
 				.request()
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 	}
 
 	// EM: This test require VPN / IDS Intranet
@@ -64,23 +66,23 @@
 	public void loginJWT() throws KustvaktException{
 		String en = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
 		/* lauffähige Version von Hanl: */
-		ClientResponse response = resource().path("auth").path("apiToken")
+		Response response = target().path("auth").path("apiToken")
 				.request()
-				.header(Attributes.AUTHORIZATION, en).get(ClientResponse.class);
+				.header(Attributes.AUTHORIZATION, en).get();
 		/**/
 		/*
-		 * Test : ClientResponse response = null; WebResource webRes =
-		 * resource().path("auth") .path("apiToken");
+		 * Test : Response response = null; WebResource webRes =
+		 * target().path("auth") .path("apiToken");
 		 * webRes.header(Attributes.AUTHORIZATION, en);
 		 * 
 		 * System.out.printf("resource: " + webRes.toString());
 		 * 
-		 * response = webRes.get(ClientResponse.class);
+		 * response = webRes.get();
 		 * 
 		 */
 
-//		assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
-		String entity = response.getEntity(String.class);
+//		assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
+		String entity = response.readEntity(String.class);
 //		System.out.println(entity);
 		JsonNode node = JsonUtils.readTree(entity);
 		assertEquals(2022, node.at("/errors/0/0").asInt());
@@ -94,13 +96,13 @@
 		assertTrue(BeansFactory.getKustvaktContext().getConfiguration().getTokenTTL() < 10);
 
 		String en = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("auth").path("apiToken")
+		Response response = target().path("auth").path("apiToken")
 				.request()
-				.header(Attributes.AUTHORIZATION, en).get(ClientResponse.class);
+				.header(Attributes.AUTHORIZATION, en).get();
 
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+		JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
 		assertNotNull(node);
 		String token = node.path("token").asText();
 
@@ -114,20 +116,20 @@
 				break;
 		}
 
-		response = resource().path("user").path("info")
+		response = target().path("user").path("info")
 				.request()
-				.header(Attributes.AUTHORIZATION, "api_token " + token).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
+				.header(Attributes.AUTHORIZATION, "api_token " + token).get();
+		assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
 	}
 
 	@Test
 	public void testGetUserDetails() throws KustvaktException {
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("user").path("details")
+		Response response = target().path("user").path("details")
 				.request()
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 	}
 
 	@Test
@@ -136,17 +138,17 @@
 		Map m = new LinkedMap();
 		m.put("test", "[100, \"error message\", true, \"another message\"]");
 
-		ClientResponse response = resource().path("user").path("details")
+		Response response = target().path("user").path("details")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.post(Entity.json(m));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("details").queryParam("pointer", "test")
+		response = target().path("user").path("details").queryParam("pointer", "test")
 				.request()
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.getEntity(String.class);
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
+		String ent = response.readEntity(String.class);
 		assertEquals("[100, \"error message\", true, \"another message\"]", ent);
 	}
 
@@ -156,18 +158,18 @@
 		Map m = new LinkedMap();
 		m.put("test", "test value 1");
 
-		ClientResponse response = resource().path("user").path("details")
+		Response response = target().path("user").path("details")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.post(Entity.json(m));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("details")
+		response = target().path("user").path("details")
 				.request()
-               .header(Attributes.AUTHORIZATION, enc)
-				.get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.getEntity(String.class);
+				.header(Attributes.AUTHORIZATION, enc)
+				.get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
+		String ent = response.readEntity(String.class);
 		JsonNode node = JsonUtils.readTree(ent);
 		assertNotNull(node);
 		assertEquals("test value 1", node.at("/test").asText());
@@ -178,13 +180,12 @@
 	@Test
 	public void testGetUserDetailsPointer() throws KustvaktException {
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("user").path("details")
+		Response response = target().path("user").path("details")
 				.queryParam("pointer", "email")
 				.request()
-				.header(Attributes.AUTHORIZATION, enc)
-				.get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.getEntity(String.class);
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
+		String ent = response.readEntity(String.class);
 		assertEquals("test@ids-mannheim.de", ent);
 	}
 
@@ -193,11 +194,11 @@
 //		helper().setupSimpleAccount("userservicetest", "servicepass");
 
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue("userservicetest", "servicepass");
-		ClientResponse response = resource().path("user").path("details")
+		Response response = target().path("user").path("details")
 				.request()
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
-		String entity = response.getEntity(String.class);
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
+		String entity = response.readEntity(String.class);
 		JsonNode node = JsonUtils.readTree(entity);
 		assertNotNull(node);
 		assertEquals(StatusCodes.NO_RESOURCE_FOUND, node.at("/errors/0/0").asInt());
@@ -207,10 +208,10 @@
 	@Test
 	public void testGetUserSettings() throws KustvaktException {
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("user").path("settings")
+		Response response = target().path("user").path("settings")
 				.request()
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 	}
 
 	@Test
@@ -221,19 +222,19 @@
 		m.put("lastName", "newLastName");
 		m.put("email", "newtest@ids-mannheim.de");
 
-		ClientResponse response = resource().path("user").path("details")
+		Response response = target().path("user").path("details")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.post(Entity.json(m));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("details")
+		response = target().path("user").path("details")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc)
-				.get(ClientResponse.class);
+				.get();
 
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
-		JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
+		JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
 		assertNotNull(node);
 		assertEquals("newName", node.path("firstName").asText());
 		assertEquals("newLastName", node.path("lastName").asText());
@@ -245,54 +246,56 @@
 		m.put("lastName", "user");
 		m.put("email", "test@ids-mannheim.de");
 
-		response = resource().path("user").path("details")
+		response = target().path("user").path("details")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", MediaType.APPLICATION_JSON).post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.header("Content-Type", MediaType.APPLICATION_JSON)
+				.post(Entity.json(m));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 	}
 
 	@Test
 	@Ignore
 	public void testUpdateUserSettingsForm() throws IOException, KustvaktException{
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		MultivaluedMap m = new MultivaluedMapImpl();
-		m.putSingle("queryLanguage", "poliqarp_test");
-		m.putSingle("pageLength", "200");
+		Form m = new Form();
+		m.param("queryLanguage", "poliqarp_test");
+		m.param("pageLength", "200");
 
-		ClientResponse response = resource().path("user").path("settings")
+		Response response = target().path("user").path("settings")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", "application/x-www-form-urlencodeBase64d")
-				.get(ClientResponse.class);
+				.get();
 
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		JsonNode map = JsonUtils.readTree(response.getEntity(String.class));
+		JsonNode map = JsonUtils.readTree(response.readEntity(String.class));
 		assertNotNull(map);
 
-		assertNotEquals(m.getFirst("queryLanguage"), map.get("queryLanguage"));
-		assertNotEquals(m.get("pageLength"), Integer.valueOf((String) m.getFirst("pageLength")));
+		assertNotEquals(m.asMap().getFirst("queryLanguage"), map.get("queryLanguage"));
+		assertNotEquals(m.asMap().get("pageLength"), Integer.valueOf((String) m.asMap().getFirst("pageLength")));
 
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("settings")
+		response = target().path("user").path("settings")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc)
 				.header("Content-Type", "application/x-www-form-urlencodeBase64d")
-				.post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.post(Entity.form(m));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("settings").header(Attributes.AUTHORIZATION, enc)
+		response = target().path("user").path("settings")
 				.request()
-				.header("Content-Type", "application/x-www-form-urlencodeBase64d").get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.header(Attributes.AUTHORIZATION, enc)
+				.header("Content-Type", "application/x-www-form-urlencodeBase64d").get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		map = JsonUtils.readTree(response.getEntity(String.class));
+		map = JsonUtils.readTree(response.readEntity(String.class));
 		assertNotNull(map);
 
-		assertEquals(map.get("queryLanguage"), m.getFirst("queryLanguage"));
+		assertEquals(map.get("queryLanguage"), m.asMap().getFirst("queryLanguage"));
 		int p1 = map.path("pageLength").asInt();
-		int p2 = Integer.valueOf((String) m.getFirst("pageLength"));
+		int p2 = Integer.valueOf((String) m.asMap().getFirst("pageLength"));
 		assertEquals(p1, p2);
 	}
 
@@ -304,35 +307,35 @@
 		m.put("pageLength", "200");
 		m.put("setting_1", "value_1");
 
-		ClientResponse response = resource().path("user").path("settings")
+		Response response = target().path("user").path("settings")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc).header("Content-Type", MediaType.APPLICATION_JSON)
-				.get(ClientResponse.class);
+				.get();
 
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		JsonNode map = JsonUtils.readTree(response.getEntity(String.class));
+		JsonNode map = JsonUtils.readTree(response.readEntity(String.class));
 		assertNotNull(map);
 
 		assertNotEquals(m.get("queryLanguage"), map.get("queryLanguage"));
 		assertNotEquals(m.get("pageLength"), Integer.valueOf((String) m.get("pageLength")));
 
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("settings")
+		response = target().path("user").path("settings")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc)
 				.header("Content-Type", MediaType.APPLICATION_JSON)
-				.post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.post(Entity.json(m));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("settings")
+		response = target().path("user").path("settings")
 				.request()
 				.header(Attributes.AUTHORIZATION, enc)
-				.get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+				.get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		map = JsonUtils.readTree(response.getEntity(String.class));
+		map = JsonUtils.readTree(response.readEntity(String.class));
 		assertNotNull(map);
 
 		assertEquals(map.path("queryLanguage").asText(), m.get("queryLanguage"));
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
index 490f072..29471a0 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/StatisticsControllerTest.java
@@ -5,13 +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.Response.Status;
 
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
@@ -28,20 +30,20 @@
     public void testGetStatisticsNoResource ()
             throws IOException, KustvaktException {
         String corpusQuery = "corpusSigle=WPD15";
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .queryParam("corpusQuery", corpusQuery)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+        assert Status.OK.getStatusCode() == response.getStatus();
 
         assertEquals(
             "Wes8Bd4h1OypPqbWF5njeQ==",
             response.getHeaders().getFirst("X-Index-Revision")
             );
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(node.get("documents").asInt(),0);
         assertEquals(node.get("tokens").asInt(),0);
@@ -49,14 +51,14 @@
 
     @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());
-        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,15 +70,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());
@@ -90,15 +92,15 @@
     public void testGetStatisticsWithcorpusQuery1 ()
             throws IOException, KustvaktException {
         String corpusQuery = "corpusSigle=GOE";
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .queryParam("corpusQuery", corpusQuery)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+        assert Status.OK.getStatusCode() == response.getStatus();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(node.get("documents").asInt(),11);
         assertEquals(node.get("tokens").asInt(),665842);
@@ -113,14 +115,14 @@
     @Test
     public void testGetStatisticsWithcorpusQuery2 ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .queryParam("corpusQuery", "creationDate since 1810")
                 .request()
-                .get(ClientResponse.class);
-        String ent = response.getEntity(String.class);
+                .get();
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
-        assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
+        assert Status.OK.getStatusCode() == response.getStatus();
         assertEquals(node.get("documents").asInt(),7);
         assertEquals(node.get("tokens").asInt(),279402);
         assertEquals(node.get("sentences").asInt(), 11047);
@@ -131,15 +133,15 @@
     @Test
     public void testGetStatisticsWithWrongcorpusQuery ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .queryParam("corpusQuery", "creationDate geq 1810")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        assert ClientResponse.Status.BAD_REQUEST.getStatusCode() == response
+        assert 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(), 302);
         assertEquals(node.at("/errors/0/1").asText(),
@@ -152,14 +154,14 @@
     @Test
     public void testGetStatisticsWithWrongcorpusQuery2 ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .queryParam("corpusQuery", "creationDate >= 1810")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        String ent = response.readEntity(String.class);
+        assertEquals(Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
         
         JsonNode node = JsonUtils.readTree(ent);
@@ -173,14 +175,14 @@
     @Test
     public void testGetStatisticsWithoutcorpusQuery ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
                 .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);
 		assertEquals(11, node.at("/documents").asInt());
@@ -192,23 +194,23 @@
     @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(
             "Wes8Bd4h1OypPqbWF5njeQ==",
             response.getHeaders().getFirst("X-Index-Revision")
             );
         
-        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);
         assertEquals(2, node.at("/documents").asInt());
@@ -220,15 +222,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);
@@ -239,15 +241,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());
@@ -258,13 +260,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/full/src/test/java/de/ids_mannheim/korap/web/controller/TokenExpiryTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/TokenExpiryTest.java
index 099027a..3b1d086 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/TokenExpiryTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/TokenExpiryTest.java
@@ -4,7 +4,9 @@
 
 import java.io.IOException;
 
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.Response.Status;
 
 import org.apache.http.HttpStatus;
 import org.apache.http.entity.ContentType;
@@ -12,8 +14,7 @@
 
 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 javax.ws.rs.core.Response;
 
 import de.ids_mannheim.korap.config.Attributes;
 import de.ids_mannheim.korap.config.SpringJerseyTest;
@@ -34,20 +35,20 @@
     @Test
     public void requestToken ()
             throws KustvaktException, InterruptedException, IOException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("grant_type", "password");
-        form.add("client_id", "fCBbQkAyYzI4NzUxMg");
-        form.add("client_secret", "secret");
-        form.add("username", "dory");
-        form.add("password", "password");
+        Form form = new Form();
+        form.param("grant_type", "password");
+        form.param("client_id", "fCBbQkAyYzI4NzUxMg");
+        form.param("client_secret", "secret");
+        form.param("username", "dory");
+        form.param("password", "password");
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2").path("token")
+        Response response = target().path(API_VERSION).path("oauth2").path("token")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE,
                         ContentType.APPLICATION_FORM_URLENCODED)
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         String token = node.at("/access_token").asText();
 
@@ -65,15 +66,15 @@
     // does not work.
     private void testSearchWithExpiredToken (String token)
             throws KustvaktException, IOException {
-        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, "Bearer " + token)
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
 
-        assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(),
+        assertEquals(Status.UNAUTHORIZED.getStatusCode(),
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(ent);
@@ -85,25 +86,25 @@
     // cannot be tested dynamically
     private void testRequestAuthorizationCodeAuthenticationTooOld (String token)
             throws KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("response_type", "code");
-        form.add("client_id", "fCBbQkAyYzI4NzUxMg");
-        form.add("redirect_uri",
+        Form form = new Form();
+        form.param("response_type", "code");
+        form.param("client_id", "fCBbQkAyYzI4NzUxMg");
+        form.param("redirect_uri",
                 "https://korap.ids-mannheim.de/confidential/redirect");
-        form.add("scope", "openid");
-        form.add("max_age", "1");
+        form.param("scope", "openid");
+        form.param("max_age", "1");
 
-        ClientResponse response =
-                resource().path(API_VERSION).path("oauth2").path("openid").path("authorize")
+        Response response =
+                target().path(API_VERSION).path("oauth2").path("openid").path("authorize")
                         .request()
                         .header(Attributes.AUTHORIZATION, "Bearer " + token)
                         .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                         .header(HttpHeaders.CONTENT_TYPE,
                                 ContentType.APPLICATION_FORM_URLENCODED)
-                        .entity(form).post(ClientResponse.class);
+                        .post(Entity.form(form));
 
         assertEquals(HttpStatus.SC_UNAUTHORIZED, response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.USER_REAUTHENTICATION_REQUIRED,
                 node.at("/errors/0/0").asInt());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
index 2980ca2..617757c 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerAdminTest.java
@@ -2,18 +2,17 @@
 
 import static org.junit.Assert.assertEquals;
 
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Form;
 
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.client.Entity;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -35,32 +34,32 @@
     private JsonNode listGroup (String username)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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);
         return node;
     }
 
     @Test
     public void testListDoryGroups () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("list").path("system-admin")
                 .queryParam("username", "dory")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(3, node.size());
@@ -68,17 +67,17 @@
 
     @Test
     public void testListDoryActiveGroups () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("list").path("system-admin")
                 .queryParam("username", "dory").queryParam("status", "ACTIVE")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.size());
@@ -88,31 +87,31 @@
     @Test
     public void testListWithoutUsername () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals("[]", entity);
     }
 
     @Test
     public void testListByStatusAll () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("list").path("system-admin")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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);
 
         boolean containsHiddenStatus = false;
@@ -127,17 +126,17 @@
     @Test
     public void testListByStatusHidden () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("list").path("system-admin")
                 .queryParam("status", "HIDDEN")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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(1, node.size());
         assertEquals(3, node.at("/0/id").asInt());
@@ -149,16 +148,15 @@
 
         String groupName = "admin-test-group";
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@" + groupName)
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue(testUser,
                                         "password"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .put(ClientResponse.class);
+                .put(Entity.form(new Form()));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -179,7 +177,7 @@
             KustvaktException {
 
         // accept invitation
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@" + groupName).path("subscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
@@ -187,7 +185,7 @@
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue(
                                         memberUsername, "pass"))
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -198,21 +196,20 @@
     private void testAddMemberRoles (String groupName, String memberUsername)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> map = new MultivaluedMapImpl();
-        map.add("memberUsername", memberUsername);
-        map.add("roleId", "1"); // USER_GROUP_ADMIN
-        map.add("roleId", "2"); // USER_GROUP_MEMBER
+        Form form = new Form();
+        form.param("memberUsername", memberUsername);
+        form.param("roleId", "1"); // USER_GROUP_ADMIN
+        form.param("roleId", "2"); // USER_GROUP_MEMBER
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@" + groupName).path("role").path("add")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue(adminUser,
                                         "password"))
-                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32").entity(map)
-                .post(ClientResponse.class);
+                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -232,20 +229,19 @@
     private void testDeleteMemberRoles (String groupName, String memberUsername)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> map = new MultivaluedMapImpl();
-        map.add("memberUsername", memberUsername);
-        map.add("roleId", "1"); // USER_GROUP_ADMIN
+        Form form = new Form();
+        form.param("memberUsername", memberUsername);
+        form.param("roleId", "1"); // USER_GROUP_ADMIN
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@" + groupName).path("role").path("delete")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue(adminUser,
                                         "password"))
-                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32").entity(map)
-                .post(ClientResponse.class);
+                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -263,17 +259,17 @@
     private JsonNode retrieveGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@" + groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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);
         return node;
     }
@@ -282,13 +278,13 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // delete group
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@" + groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -301,13 +297,13 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // delete marlin from group
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@" + groupName).path("~marlin")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -323,17 +319,16 @@
     private void testInviteMember (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("members", "marlin,nemo,darla");
+        Form form = new Form();
+        form.param("members", "marlin,nemo,darla");
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@" + groupName).path("invite")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(adminUser, "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
index c0ffafd..b827408 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserGroupControllerTest.java
@@ -4,8 +4,7 @@
 
 import java.util.Set;
 
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Form;
 
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,10 +12,10 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.client.Entity;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -45,13 +44,13 @@
     private JsonNode retrieveUserGroups (String username)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -59,13 +58,13 @@
     }
     
     private void deleteGroupByName (String groupName) throws KustvaktException{
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
         
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
     }
@@ -73,13 +72,13 @@
     // dory is a group admin in dory-group
     @Test
     public void testListDoryGroups () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -94,13 +93,13 @@
     // nemo is a group member in dory-group
     @Test
     public void testListNemoGroups () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("nemo", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
@@ -115,13 +114,13 @@
     // marlin has 2 groups
     @Test
     public void testListMarlinGroups () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.size());
@@ -129,11 +128,11 @@
 
     @Test
     public void testListGroupGuest () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -148,7 +147,7 @@
     public void testCreateGroupEmptyDescription () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         String groupName = "empty_group";
-        ClientResponse response = testCreateUserGroup(groupName,"");
+        Response response = testCreateUserGroup(groupName,"");
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
         
         deleteGroupByName(groupName);
@@ -160,38 +159,38 @@
             ClientHandlerException, KustvaktException {
         String groupName = "missing-desc-group";
 
-        ClientResponse response = testCreateGroupWithoutDescription(groupName);
+        Response response = testCreateGroupWithoutDescription(groupName);
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
         deleteGroupByName(groupName);
     }
     
-    private ClientResponse testCreateUserGroup (String groupName, String description)
+    private Response testCreateUserGroup (String groupName, String description)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("description", description);
+        Form form = new Form();
+        form.param("description", description);
         
-        ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("@"+groupName).type(MediaType.APPLICATION_FORM_URLENCODED)
-                .request()
-                .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
-                        .createBasicAuthorizationHeaderValue(username, "pass"))
-                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32").entity(form)
-                .put(ClientResponse.class);
-
-        return response;
-    }
-    
-    private ClientResponse testCreateGroupWithoutDescription (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
-            KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
-                .path("@"+groupName).type(MediaType.APPLICATION_FORM_URLENCODED)
+        Response response = target().path(API_VERSION).path("group")
+                .path("@"+groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .put(ClientResponse.class);
+                .put(Entity.form(form));
+
+        return response;
+    }
+    
+    private Response testCreateGroupWithoutDescription (String groupName)
+            throws UniformInterfaceException, ClientHandlerException,
+            KustvaktException {
+        Response response = target().path(API_VERSION).path("group")
+                .path("@"+groupName)
+                .request()
+                .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
+                        .createBasicAuthorizationHeaderValue(username, "pass"))
+                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
+                .put(Entity.form(new Form()));
 
         return response;
     }
@@ -201,10 +200,10 @@
             ClientHandlerException, KustvaktException {
         String groupName = "invalid-group-name$"; 
 
-        ClientResponse response = testCreateGroupWithoutDescription(groupName);
+        Response response = testCreateGroupWithoutDescription(groupName);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
         
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.INVALID_ARGUMENT, node.at("/errors/0/0").asInt());
 //        assertEquals("User-group name must only contains letters, numbers, "
 //                + "underscores, hypens and spaces", node.at("/errors/0/1").asText());
@@ -216,10 +215,10 @@
             ClientHandlerException, KustvaktException {
         String groupName = "a"; 
 
-        ClientResponse response = testCreateGroupWithoutDescription(groupName);
+        Response response = testCreateGroupWithoutDescription(groupName);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
         
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.INVALID_ARGUMENT, node.at("/errors/0/0").asInt());
         assertEquals("groupName must contain at least 3 characters",
                 node.at("/errors/0/1").asText());
@@ -233,7 +232,7 @@
         String groupName = "new-user-group";
         String description= "This is new-user-group.";
         
-        ClientResponse response =
+        Response response =
                 testCreateUserGroup(groupName, description);
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
         // same name
@@ -272,7 +271,7 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         String description = "Description is updated.";
-        ClientResponse response = testCreateUserGroup(groupName, description);
+        Response response = testCreateUserGroup(groupName, description);
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
         JsonNode node = retrieveUserGroups(username);
@@ -284,22 +283,22 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // delete darla from group
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName).path("~darla")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         // check group member
-        response = resource().path(API_VERSION).path("group")
+        response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         node = node.get(0);
         assertEquals(1, node.get("members").size());
@@ -309,15 +308,15 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // nemo is a group member
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName).path("~darla")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("nemo", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -331,13 +330,13 @@
     private void testDeletePendingMember () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         // dory delete pearl
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("~pearl")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -349,15 +348,15 @@
     @Test
     public void testDeleteDeletedMember () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("~pearl")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
@@ -372,30 +371,30 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // delete group
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         // EM: this is so complicated because the group retrieval are not allowed 
         // for delete groups
         // check group
-        response = resource().path(API_VERSION).path("group").path("list")
+        response = target().path(API_VERSION).path("group").path("list")
                 .path("system-admin").queryParam("username", username)
                 .queryParam("status", "DELETED")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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);
         for (int j = 0; j < node.size(); j++){
             JsonNode group = node.get(j);
@@ -411,15 +410,15 @@
     public void testDeleteGroupUnauthorized () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         // dory is a group admin in marlin-group
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@marlin-group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -432,17 +431,17 @@
     @Test
     public void testDeleteDeletedGroup () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@deleted-group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         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.GROUP_DELETED, node.at("/errors/0/0").asInt());
         assertEquals("Group deleted-group has been deleted.",
@@ -455,15 +454,15 @@
             ClientHandlerException, KustvaktException {
         // delete marlin from marlin-group
         // dory is a group admin in marlin-group
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@marlin-group").path("~marlin")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
@@ -475,29 +474,28 @@
     private void testInviteMember (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("members", "darla");
+        Form form = new Form();
+        form.param("members", "darla");
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName).path("invite")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         // list group
-        response = resource().path(API_VERSION).path("group")
+        response = target().path(API_VERSION).path("group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(entity);
         node = node.get(0);
@@ -511,17 +509,16 @@
 
     private void testInviteDeletedMember () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("members", "marlin");
+        Form form = new Form();
+        form.param("members", "marlin");
         
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("invite")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -538,17 +535,16 @@
     public void testInviteDeletedMember2 () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         // pearl has status deleted in dory-group
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("members", "pearl");
+        Form form = new Form();
+        form.param("members", "pearl");
         
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("invite")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -566,18 +562,17 @@
     public void testInvitePendingMember () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         // marlin has status PENDING in dory-group
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("members", "marlin");
+        Form form = new Form();
+        form.param("members", "marlin");
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("invite")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
-                .entity(form).post(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .post(Entity.form(form));
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
@@ -595,21 +590,20 @@
     public void testInviteActiveMember () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
         // nemo has status active in dory-group
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("members", "nemo");
+        Form form = new Form();
+        form.param("members", "nemo");
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("invite")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         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.GROUP_MEMBER_EXISTS,
                 node.at("/errors/0/0").asInt());
@@ -625,21 +619,20 @@
     public void testInviteMemberToDeletedGroup ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("members", "nemo");
+        Form form = new Form();
+        form.param("members", "nemo");
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@deleted-group").path("invite")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         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.GROUP_DELETED, node.at("/errors/0/0").asInt());
         assertEquals("Group deleted-group has been deleted.",
@@ -650,13 +643,13 @@
     // marlin has GroupMemberStatus.PENDING in dory-group
     @Test
     public void testSubscribePendingMember () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("subscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -690,14 +683,14 @@
     // pearl has GroupMemberStatus.DELETED in dory-group
     @Test
     public void testSubscribeDeletedMember () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("subscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .post(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .post(Entity.form(new Form()));
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
@@ -709,27 +702,27 @@
 
     @Test
     public void testSubscribeMissingGroupName() throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("subscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("bruce", "pass"))
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
         assertEquals(Status.NOT_FOUND.getStatusCode(),
                 response.getStatus());
     }
 
     @Test
     public void testSubscribeNonExistentMember () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("subscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("bruce", "pass"))
-                .post(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .post(Entity.form(new Form()));
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
 
@@ -742,14 +735,14 @@
 
     @Test
     public void testSubscribeToNonExistentGroup () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@non-existent").path("subscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .post(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .post(Entity.form(new Form()));
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
@@ -762,17 +755,17 @@
     private void testSubscribeToDeletedGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName).path("subscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("nemo", "pass"))
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
 
         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.GROUP_DELETED, node.at("/errors/0/0").asInt());
         assertEquals("Group new-user-group has been deleted.",
@@ -782,13 +775,13 @@
     private void testUnsubscribeActiveMember (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName).path("unsubscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -798,14 +791,14 @@
 
     private void checkGroupMemberRole (String groupName, String deletedMemberName)
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -825,15 +818,15 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
         // pearl unsubscribes from dory-group
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("unsubscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
@@ -852,13 +845,13 @@
         JsonNode node = retrieveUserGroups("marlin");
         assertEquals(2, node.size());
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("unsubscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -872,30 +865,30 @@
 
     @Test
     public void testUnsubscribeMissingGroupName () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("unsubscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
     }
 
     @Test
     public void testUnsubscribeNonExistentMember () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@dory-group").path("unsubscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("bruce", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         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.GROUP_MEMBER_NOT_FOUND,
@@ -906,17 +899,17 @@
 
     @Test
     public void testUnsubscribeToNonExistentGroup () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@tralala-group").path("unsubscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
@@ -929,17 +922,17 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName).path("unsubscribe")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("nemo", "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         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.GROUP_DELETED, node.at("/errors/0/0").asInt());
         assertEquals("Group new-user-group has been deleted.",
@@ -949,17 +942,16 @@
     @Test
     public void testAddSameMemberRole () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("memberUsername", "dory");
-        form.add("roleId", "1");
+        Form form = new Form();
+        form.param("memberUsername", "dory");
+        form.param("roleId", "1");
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@marlin-group").path("role").path("add")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -971,17 +963,16 @@
     @Test
     public void testDeleteAddMemberRole () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("memberUsername", "dory");
-        form.add("roleId", "1");
+        Form form = new Form();
+        form.param("memberUsername", "dory");
+        form.param("roleId", "1");
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@marlin-group").path("role").path("delete")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -995,16 +986,15 @@
     @Test
     public void testEditMemberRoleEmpty () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("memberUsername", "dory");
+        Form form = new Form();
+        form.param("memberUsername", "dory");
         
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@marlin-group").path("role").path("edit")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .post(ClientResponse.class, form);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -1018,18 +1008,17 @@
     private void testEditMemberRole ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("memberUsername", "dory");
-        form.add("roleId", "1");
-        form.add("roleId", "3");
+        Form form = new Form();
+        form.param("memberUsername", "dory");
+        form.param("roleId", "1");
+        form.param("roleId", "3");
 
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@marlin-group").path("role").path("edit")
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
-                .entity(form).post(ClientResponse.class);
+                .post(Entity.form(form));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserSettingControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserSettingControllerTest.java
index 2272488..40fa517 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/UserSettingControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/UserSettingControllerTest.java
@@ -6,14 +6,14 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.ws.rs.core.MediaType;
+import javax.ws.rs.client.Entity;
 
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-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.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -31,15 +31,14 @@
     private String username = "UserSetting_Test";
     private String username2 = "UserSetting.Test2";
 
-    public ClientResponse sendPutRequest (String username,
+    public Response sendPutRequest (String username,
             Map<String, Object> map) throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .type(MediaType.APPLICATION_JSON).entity(map)
-                .put(ClientResponse.class);
+                .put(Entity.json(map));
 
         return response;
     }
@@ -50,13 +49,12 @@
                 "{\"pos-foundry\":\"opennlp\",\"metadata\":[\"author\", \"title\","
                         + "\"textSigle\", \"availability\"],\"resultPerPage\":25}";
 
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .type(MediaType.APPLICATION_JSON).entity(json)
-                .put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -79,7 +77,7 @@
         map.put("resultPerPage", 25);
         map.put("metadata", "author title textSigle availability");
 
-        ClientResponse response = sendPutRequest(username2, map);
+        Response response = sendPutRequest(username2, map);
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
         testRetrieveSettings(username2, "opennlp", 25,
@@ -94,10 +92,10 @@
         Map<String, Object> map = new HashMap<>();
         map.put("key/", "invalidKey");
 
-        ClientResponse response = sendPutRequest(username2, map);
+        Response response = sendPutRequest(username2, map);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.INVALID_ARGUMENT,
                 node.at("/errors/0/0").asInt());
         assertEquals("key/", node.at("/errors/0/2").asText());
@@ -109,16 +107,15 @@
                 "{\"pos-foundry\":\"opennlp\",\"metadata\":\"author title "
                         + "textSigle availability\",\"resultPerPage\":25}";
 
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username2, "pass"))
-                .type(MediaType.APPLICATION_JSON).entity(json)
-                .put(ClientResponse.class);
+                .put(Entity.json(json));
 
         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());
@@ -126,15 +123,15 @@
 
     @Test
     public void testGetDifferentUsername () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username2, "pass"))
-                .get(ClientResponse.class);
+                .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());
@@ -143,16 +140,16 @@
     @Test
     public void testGetSettingNotExist () throws KustvaktException {
         String username = "tralala";
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
@@ -166,52 +163,52 @@
     @Test
     public void testDeleteSettingNotExist () throws KustvaktException {
         String username = "tralala";
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
     }
 
     @Test
     public void testDeleteKeyDifferentUsername () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting").path("pos-foundry")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username2, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         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());
     }
 
     private void testDeleteSetting (String username) throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        response = resource().path(API_VERSION).path("~" + username)
+        response = target().path(API_VERSION).path("~" + username)
                 .path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
@@ -223,12 +220,12 @@
     // the purpose of the request has been achieved.
     private void testDeleteKeyNotExist (String username)
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting").path("lemma-foundry")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
     }
@@ -236,12 +233,12 @@
     private void testDeleteKey (String username, int numOfResult,
             String metadata, boolean isMetadataArray) throws KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting").path("pos-foundry")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         testRetrieveSettings(username, null, numOfResult, metadata,
@@ -254,7 +251,7 @@
         map.put("resultPerPage", 15);
         map.put("metadata", "author title");
 
-        ClientResponse response = sendPutRequest(username, map);
+        Response response = sendPutRequest(username, map);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         testRetrieveSettings(username, "malt", 15, "author title", false);
@@ -263,15 +260,15 @@
     private void testRetrieveSettings (String username, String posFoundry,
             int numOfResult, String metadata, boolean isMetadataArray)
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("~" + username).path("setting")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(entity);
         if (posFoundry == null) {
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
index a3ca5cb..128d6a5 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VCReferenceTest.java
@@ -12,8 +12,8 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
-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.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.cache.VirtualCorpusCache;
@@ -82,14 +82,14 @@
     }
     
     private int testSearchWithoutRef_VC1 () 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("cq",
                         "textSigle=\"GOE/AGF/00000\" | textSigle=\"GOE/AGA/01784\"")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         int size = node.at("/matches").size();
         assertTrue(size > 0);
@@ -97,14 +97,14 @@
     }
 
     private int testSearchWithoutRef_VC2 () 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("cq",
                         "textSigle!=\"GOE/AGI/04846\" & textSigle!=\"GOE/AGA/01784\"")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         int size = node.at("/matches").size();
         assertTrue(size > 0);
@@ -112,37 +112,37 @@
     }
 
     private JsonNode testSearchWithRef_VC1 () 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("cq", "referTo \"system/named-vc1\"")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         return JsonUtils.readTree(ent);
     }
 
     private JsonNode testSearchWithRef_VC2 () 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("cq", "referTo named-vc2")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         return JsonUtils.readTree(ent);
     }
 
     @Test
     public void testStatisticsWithRef () throws KustvaktException {
         String corpusQuery = "availability = /CC-BY.*/ & referTo named-vc1";
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics").queryParam("corpusQuery", corpusQuery)
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(2, node.at("/documents").asInt());
         
@@ -152,13 +152,13 @@
 
     @Test
     public void testRefVcNotExist () 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("cq", "referTo \"username/vc1\"")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
@@ -167,13 +167,13 @@
 
     @Test
     public void testRefNotAuthorized() 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("cq", "referTo \"dory/dory-vc\"")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -182,13 +182,13 @@
     
     @Test
     public void testSearchWithRefPublishedVcGuest () 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("cq", "referTo \"marlin/published-vc\"")
                 .request()
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertTrue(node.at("/matches").size() > 0);
         
@@ -208,30 +208,30 @@
     
     @Test
     public void testSearchWithRefPublishedVc () 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("cq", "referTo \"marlin/published-vc\"")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("squirt", "pass"))
-                .get(ClientResponse.class);
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertTrue(node.at("/matches").size() > 0);
         
         // check dory in the hidden group of the vc
-        response = resource().path(API_VERSION).path("group")
+        response = target().path(API_VERSION).path("group")
                 .path("list").path("system-admin")
                 .queryParam("status", "HIDDEN")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("admin", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         node = JsonUtils.readTree(entity);
         assertEquals(3, node.at("/0/id").asInt());
         
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerAdminTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerAdminTest.java
index 4b2afdd..f15499a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerAdminTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerAdminTest.java
@@ -2,7 +2,7 @@
 
 import static org.junit.Assert.assertEquals;
 
-import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Form;
 
 import org.apache.http.entity.ContentType;
 import org.junit.Test;
@@ -10,9 +10,10 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 import com.sun.jersey.api.client.UniformInterfaceException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.client.Entity;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -32,17 +33,17 @@
     @Test
     public void testSearchPrivateVC () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path("dory-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .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(1, node.at("/id").asInt());
@@ -53,14 +54,14 @@
     public void testSearchProjectVC () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path("group-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -73,35 +74,35 @@
     @Test
     public void testListDoryVC () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .queryParam("username", "dory")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
-                .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(4, node.size());
     }
 
     private JsonNode testListSystemVC () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("list").path("system-admin").queryParam("type", "SYSTEM")
                 .queryParam("createdBy", "system")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
 
@@ -111,13 +112,13 @@
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + ",\"corpusQuery\": \"creationDate since 1820\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~system").path("new-system-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -130,13 +131,13 @@
     private void testDeleteSystemVC (String vcCreator, String vcName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~system").path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -152,14 +153,14 @@
                 + ",\"corpusQuery\": \"corpusSigle=GOE\"}";
 
         String vcName = "new-vc";
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+username).path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -173,18 +174,18 @@
     private JsonNode testListUserVC (String username)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("list").path("system-admin")
                 .queryParam("createdBy", username)
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
 
@@ -194,14 +195,14 @@
 
         String json = "{\"description\": \"edited vc\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+vcCreator).path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
@@ -212,13 +213,13 @@
     private void testDeletePrivateVC (String vcCreator, String vcName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+vcCreator).path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -228,16 +229,16 @@
 
 //    @Deprecated
 //    private String testlistAccessByVC (String groupName) throws KustvaktException {
-//        ClientResponse response = resource().path(API_VERSION).path("vc")
+//        Response response = target().path(API_VERSION).path("vc")
 //                .path("access")
 //                .queryParam("groupName", groupName)
 //                .request()
 //                .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
 //                        .createBasicAuthorizationHeaderValue(admin, "pass"))
 //                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-//                .get(ClientResponse.class);
+//                .get();
 //
-//        String entity = response.getEntity(String.class);
+//        String entity = response.readEntity(String.class);
 //        JsonNode node = JsonUtils.readTree(entity);
 //        assertEquals(1, node.size());
 //        node = node.get(0);
@@ -253,15 +254,15 @@
 
     private JsonNode testlistAccessByGroup (String groupName)
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("access")
                 .queryParam("groupName", groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.size());
         return node.get(node.size()-1);
@@ -286,16 +287,15 @@
     private void testCreateVCAccess (String vcCreator, String vcName,
             String groupName) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response;
+        Response response;
         // share VC
-        response = resource().path(API_VERSION).path("vc").path("~"+vcCreator)
+        response = target().path(API_VERSION).path("vc").path("~"+vcCreator)
                 .path(vcName).path("share").path("@"+groupName)
-                .type(MediaType.APPLICATION_FORM_URLENCODED)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(admin, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -305,13 +305,13 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("access").path(accessId)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
index 2750fae..ac0ed0a 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusControllerTest.java
@@ -18,10 +18,12 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.spi.container.ContainerRequest;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.client.Entity;
+import org.glassfish.jersey.server.ContainerRequest;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -39,11 +41,11 @@
 
     private String testUser = "vcControllerTest";
 
-    private void checkWWWAuthenticateHeader (ClientResponse response) {
-        Set<Entry<String, List<String>>> headers =
+    private void checkWWWAuthenticateHeader (Response response) {
+        Set<Entry<String, List<Object>>> headers =
                 response.getHeaders().entrySet();
 
-        for (Entry<String, List<String>> header : headers) {
+        for (Entry<String, List<Object>> header : headers) {
             if (header.getKey().equals(ContainerRequest.WWW_AUTHENTICATE)) {
                 assertEquals("Api realm=\"Kustvakt\"",
                         header.getValue().get(0));
@@ -58,15 +60,15 @@
     private JsonNode testListVC (String username)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         return JsonUtils.readTree(entity);
     }
@@ -74,43 +76,43 @@
     private JsonNode testListOwnerVC (String username)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~" + username)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
 
     private void testDeleteVC (String vcName, String vcCreator, String username)
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~" + vcCreator).path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
     }
 
     private JsonNode testlistAccessByGroup (String username, String groupName)
             throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("access").queryParam("groupName", groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         return node;
     }
@@ -132,11 +134,11 @@
     public void testRetrieveSystemVCGuest () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~system").path("system-vc")
                 .request()
-                .get(ClientResponse.class);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+                .get();
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals("system-vc", node.at("/name").asText());
         assertEquals(ResourceType.SYSTEM.displayName(),
                 node.at("/type").asText());
@@ -161,14 +163,14 @@
     public void testRetrievePrivateVCInfoUnauthorized ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path("dory-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
@@ -194,14 +196,14 @@
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path("group-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("marlin", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
@@ -222,17 +224,17 @@
                 node.at("/type").asText());
 
         // check gill in the hidden group of the vc
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("list").path("system-admin")
                 .queryParam("status", "HIDDEN")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("admin", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         node = JsonUtils.readTree(entity);
         assertEquals(3, node.at("/0/id").asInt());
         String members = node.at("/0/members").toString();
@@ -266,14 +268,14 @@
     public void testListAvailableVCByOtherUser ()
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory")
                 .request()
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -288,10 +290,10 @@
     @Test
     public void testListAvailableVCByGuest () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .request()
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -304,13 +306,13 @@
     }
     
     private void testListSystemVC () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~system")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("pearl", "pass"))
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(2, node.size());
         assertEquals(ResourceType.SYSTEM.displayName(),
@@ -325,14 +327,14 @@
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + ",\"corpusQuery\": \"corpusSigle=GOE\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -357,14 +359,14 @@
 
         String vcName = "new-published-vc";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
 
@@ -401,15 +403,15 @@
     private JsonNode testCheckHiddenGroup (String groupName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+        Response response = target().path(API_VERSION).path("group")
                 .path("@"+groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("admin", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         return JsonUtils.readTree(entity);
     }
 
@@ -428,7 +430,7 @@
             authToken = reader.readLine();
         }
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -436,8 +438,8 @@
                                 + authToken)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .put(Entity.json(json));
+        String entity = response.readEntity(String.class);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
@@ -461,7 +463,7 @@
                 + "UiLCJleHAiOjE1MzA2MTgyOTR9.JUMvTQZ4tvdRXFBpQKzoNxrq7"
                 + "CuYAfytr_LWqY8woJs";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(Attributes.AUTHORIZATION,
@@ -469,9 +471,9 @@
                                 + authToken)
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -489,13 +491,13 @@
                 + ",\"corpusQuery\": \"pubDate since 1820\"}";
 
         String vcName = "new_system_vc";
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~system").path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("admin", "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
         
@@ -509,17 +511,17 @@
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + ",\"corpusQuery\": \"creationDate since 1820\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -535,14 +537,14 @@
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + ",\"corpusQuery\": \"creationDate since 1820\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new $vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .put(Entity.json(json));
+        String entity = response.readEntity(String.class);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -557,14 +559,14 @@
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + ",\"corpusQuery\": \"creationDate since 1820\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("ne")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .put(Entity.json(json));
+        String entity = response.readEntity(String.class);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -579,15 +581,15 @@
         String json = "{\"type\": \"PRIVATE\","
                 + "\"corpusQuery\": \"creationDate since 1820\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -603,14 +605,14 @@
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + "}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .put(Entity.json(json));
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
@@ -623,14 +625,14 @@
 
     @Test
     public void testCreateVCWithoutEntity () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .put(Entity.json(""));
+        String entity = response.readEntity(String.class);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -646,14 +648,14 @@
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + "}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .put(Entity.json(json));
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
@@ -670,15 +672,15 @@
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + ",\"corpusQuery\": \"creationDate since 1820\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+testUser).path("new_vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .entity(json).put(ClientResponse.class);
+                .put(Entity.json(json));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -691,16 +693,16 @@
 
     @Test
     public void testDeleteVCUnauthorized () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path("dory-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
 
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -718,14 +720,14 @@
         // 1st edit
         String json = "{\"description\": \"edited vc\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path("dory-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
@@ -736,14 +738,14 @@
         // 2nd edit
         json = "{\"description\": \"test vc\"}";
 
-        response = resource().path(API_VERSION).path("vc").path("~dory")
+        response = target().path(API_VERSION).path("vc").path("~dory")
                 .path("dory-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
@@ -762,13 +764,13 @@
         
         String json = "{\"corpusQuery\": \"corpusSigle=WPD17\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path("dory-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
@@ -781,16 +783,16 @@
     private JsonNode testRetrieveKoralQuery (String username, String vcName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("koralQuery").path("~" + username).path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .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);
         return node;
     }
@@ -799,15 +801,15 @@
     public void testEditVCNotOwner () throws KustvaktException {
         String json = "{\"description\": \"edited vc\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path("dory-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
-        String entity = response.getEntity(String.class);
+                .put(Entity.json(json));
+        String entity = response.readEntity(String.class);
 
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -831,14 +833,14 @@
 
         // edit vc
         String json = "{\"type\": \"PUBLISHED\"}";
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~dory").path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
         // check VC
@@ -858,14 +860,14 @@
         // edit 2nd
         json = "{\"type\": \"PROJECT\"}";
 
-        response = resource().path(API_VERSION).path("vc").path("~dory")
+        response = target().path(API_VERSION).path("vc").path("~dory")
                 .path("group-vc")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
@@ -890,16 +892,16 @@
     // @Test
     // public void testlistAccessMissingId () throws KustvaktException
     // {
-    // ClientResponse response =
-    // resource().path(API_VERSION).path("vc")
+    // Response response =
+    // target().path(API_VERSION).path("vc")
     // .path("access")
     // .request().header(Attributes.AUTHORIZATION,
     // HttpAuthorizationHandler
     // .createBasicAuthorizationHeaderValue(
     // testUser, "pass"))
     // .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-    // .get(ClientResponse.class);
-    // String entity = response.getEntity(String.class);
+    // .get();
+    // String entity = response.readEntity(String.class);
     // JsonNode node = JsonUtils.readTree(entity);
     // assertEquals(Status.BAD_REQUEST.getStatusCode(),
     // response.getStatus());
@@ -910,14 +912,14 @@
 
     @Test
     public void testlistAccessByGroup () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("access").queryParam("groupName", "dory-group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(1, node.at("/0/accessId").asInt());
@@ -940,7 +942,7 @@
         assertEquals(vcName, node.at("/name").asText());
         assertEquals("private", node.at("/type").asText());
 
-        ClientResponse response =
+        Response response =
                 testShareVCByCreator("marlin", vcName, groupName);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -974,25 +976,25 @@
         testEditVCType("marlin", "marlin", vcName, ResourceType.PRIVATE);
     }
 
-    private ClientResponse testShareVCByCreator (String vcCreator,
+    private Response testShareVCByCreator (String vcCreator,
             String vcName, String groupName) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
 
-        return resource().path(API_VERSION).path("vc").path("~"+vcCreator)
+        return target().path(API_VERSION).path("vc").path("~"+vcCreator)
                 .path(vcName).path("share").path("@"+groupName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(vcCreator, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
     }
 
     private void testShareVCNonUniqueAccess (String vcCreator, String vcName,
             String groupName) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response =
+        Response response =
                 testShareVCByCreator(vcCreator, vcName, groupName);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(HttpStatus.SC_BAD_REQUEST, response.getStatus());
         assertEquals(StatusCodes.DB_INSERT_FAILED,
                 node.at("/errors/0/0").asInt());
@@ -1006,9 +1008,9 @@
     @Test
     public void testShareUnknownVC () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = testShareVCByCreator("marlin",
+        Response response = testShareVCByCreator("marlin",
                 "non-existing-vc", "marlin group");
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatus());
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
@@ -1017,9 +1019,9 @@
     @Test
     public void testShareUnknownGroup () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = testShareVCByCreator("marlin", "marlin-vc",
+        Response response = testShareVCByCreator("marlin", "marlin-vc",
                 "non-existing-group");
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatus());
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
@@ -1030,16 +1032,16 @@
             ClientHandlerException, KustvaktException {
 
         // dory is VCA in marlin group
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~marlin").path("marlin-vc").path("share")
                 .path("@marlin group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
@@ -1053,15 +1055,15 @@
             ClientHandlerException, KustvaktException {
 
         // nemo is not VCA in marlin group
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~nemo").path("nemo-vc").path("share").path("@marlin-group")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("nemo", "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
@@ -1070,16 +1072,16 @@
                 node.at("/errors/0/1").asText());
     }
 
-    private ClientResponse testDeleteAccess (String username, String accessId)
+    private Response testDeleteAccess (String username, String accessId)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("access").path(accessId)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
         return response;
     }
@@ -1087,15 +1089,15 @@
     private void testDeleteAccessUnauthorized (String accessId)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("access").path(accessId)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(testUser, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .delete(ClientResponse.class);
+                .delete();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -1108,10 +1110,10 @@
     @Test
     public void testDeleteNonExistingAccess () throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = testDeleteAccess("dory", "100");
+        Response response = testDeleteAccess("dory", "100");
         assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus());
 
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals(StatusCodes.NO_RESOURCE_FOUND,
                 node.at("/errors/0/0").asInt());
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java
index 3761a54..e75e700 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusFieldTest.java
@@ -11,9 +11,9 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 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.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.cache.VirtualCorpusCache;
@@ -36,17 +36,17 @@
     private JsonNode testRetrieveField (String username, String vcName,
             String field) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("field").path("~" + username).path(vcName)
                 .queryParam("fieldName", field)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("admin", "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .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);
         return node;
     }
@@ -54,17 +54,17 @@
     private void testRetrieveProhibitedField (String username, String vcName,
             String field) throws UniformInterfaceException,
             ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("field").path("~" + username).path(vcName)
                 .queryParam("fieldName", field)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("admin", "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .get(ClientResponse.class);
+                .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.NOT_ALLOWED, node.at("/errors/0/0").asInt());
     }
@@ -139,17 +139,17 @@
     public void testRetrieveFieldUnauthorized () throws KustvaktException, IOException, QueryException {
         vcLoader.loadVCToCache("named-vc3", "/vc/named-vc3.jsonld");
         
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("field").path("~system").path("named-vc3")
                 .queryParam("fieldName", "textSigle")
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue("dory", "pass"))
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .get(ClientResponse.class);
+                .get();
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(StatusCodes.AUTHORIZATION_FAILED, node.at("/errors/0/0").asInt());
         assertEquals("Unauthorized operation for user: dory", node.at("/errors/0/1").asText());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusTestBase.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusTestBase.java
index bcb6b5c..403ee7c 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusTestBase.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/VirtualCorpusTestBase.java
@@ -7,9 +7,10 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.google.common.net.HttpHeaders;
 import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.ClientResponse.Status;
 import com.sun.jersey.api.client.UniformInterfaceException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.client.Entity;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.config.Attributes;
@@ -23,14 +24,14 @@
     protected JsonNode testSearchVC (String username, String vcCreator, String vcName)
             throws UniformInterfaceException, ClientHandlerException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+vcCreator).path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+                .get();
+        String entity = response.readEntity(String.class);
         // System.out.println(entity);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -42,14 +43,14 @@
             throws KustvaktException {
         String json = "{\"type\": \"" + type + "\"}";
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+        Response response = target().path(API_VERSION).path("vc")
                 .path("~"+vcCreator).path(vcName)
                 .request()
                 .header(Attributes.AUTHORIZATION, HttpAuthorizationHandler
                         .createBasicAuthorizationHeaderValue(username, "pass"))
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
-                .put(ClientResponse.class, json);
+                .put(Entity.json(json));
 
         assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
 
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());
     }
 }
