Merge pull request #471 from abcpro1/jersey-upgrade

Upgrade to Jersey 2.37 and Java 11
diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml
index 635eccd..42ec057 100644
--- a/.github/workflows/ci_test.yml
+++ b/.github/workflows/ci_test.yml
@@ -23,10 +23,10 @@
           repository: KorAP/Koral
           path: Koral
 
-      - name: Set up JDK 1.8
+      - name: Set up JDK 11
         uses: actions/setup-java@v1
         with:
-          java-version: 1.8
+          java-version: 11
 
       - name: Build and install Krill
         run: mvn --file Krill/pom.xml install
diff --git a/core/pom.xml b/core/pom.xml
index 8ef1b61..b1744a6 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -6,10 +6,10 @@
 	<version>0.68</version>
 
 	<properties>
-		<java.version>1.8</java.version>
+		<java.version>11</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<spring.version>5.3.23</spring.version>
-		<jersey.version>1.19.4</jersey.version>
+		<jersey.version>2.37</jersey.version>
 		<jetty.version>9.4.49.v20220914</jetty.version>
 		<hibernate.version>5.6.14.Final</hibernate.version>
 		<flyway.version>9.7.0</flyway.version>
@@ -105,28 +105,18 @@
 	
 		<!-- Jersey -->
 		<dependency>
-			<groupId>com.sun.jersey</groupId>
-			<artifactId>jersey-bundle</artifactId>
-			<version>${jersey.version}</version>
-		</dependency>
-		<!--EM: added -->
-		<dependency>
-			<groupId>com.sun.jersey</groupId>
+			<groupId>org.glassfish.jersey.core</groupId>
 			<artifactId>jersey-server</artifactId>
 			<version>${jersey.version}</version>
 		</dependency>
 
 		<dependency>
-			<groupId>com.sun.jersey.contribs</groupId>
-			<artifactId>jersey-spring</artifactId>
+			<groupId>org.glassfish.jersey.ext</groupId>
+			<artifactId>jersey-spring5</artifactId>
 			<version>${jersey.version}</version>
 			<exclusions>
 				<exclusion>
 					<groupId>org.springframework</groupId>
-					<artifactId>spring</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.springframework</groupId>
 					<artifactId>spring-core</artifactId>
 				</exclusion>
 				<exclusion>
@@ -150,25 +140,17 @@
 
 		<!-- JSON -->
 		<dependency>
-			<groupId>com.sun.jersey</groupId>
-			<artifactId>jersey-json</artifactId>
+			<groupId>org.glassfish.jersey.media</groupId>
+			<artifactId>jersey-media-json-jackson</artifactId>
 			<version>${jersey.version}</version>
 			<exclusions>
 				<exclusion>
-					<groupId>org.codehaus.jackson</groupId>
-					<artifactId>jackson-core-asl</artifactId>
+					<groupId>com.fasterxml.jackson.core</groupId>
+					<artifactId>jackson-annotations</artifactId>
 				</exclusion>
 				<exclusion>
-					<groupId>org.codehaus.jackson</groupId>
-					<artifactId>jackson-mapper-asl</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.codehaus.jackson</groupId>
-					<artifactId>jackson-jaxrs</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.codehaus.jackson</groupId>
-					<artifactId>jackson-xc</artifactId>
+					<groupId>com.fasterxml.jackson.core</groupId>
+					<artifactId>jackson-databind</artifactId>
 				</exclusion>
 			</exclusions>
 		</dependency>
@@ -182,7 +164,7 @@
 		<dependency>
 			<groupId>com.fasterxml.jackson.jaxrs</groupId>
 			<artifactId>jackson-jaxrs-json-provider</artifactId>
-			<version>2.12.7</version>
+			<version>[2.14.0-rc1,)</version>
 		</dependency>
 
 		<!-- Flyway -->
diff --git a/core/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java b/core/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
index 3c05116..a5d6bca 100644
--- a/core/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
+++ b/core/src/main/java/de/ids_mannheim/korap/server/KustvaktBaseServer.java
@@ -22,7 +22,8 @@
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.springframework.web.context.ContextLoaderListener;
 
-import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
+import org.glassfish.jersey.server.ServerProperties;
+import org.glassfish.jersey.servlet.ServletContainer;
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.encryption.RandomCodeGenerator;
@@ -109,9 +110,9 @@
         contextHandler.addEventListener(listener);
         contextHandler.setInitParameter("adminToken", adminToken);
 
-        ServletHolder servletHolder = new ServletHolder(new SpringServlet());
+        ServletHolder servletHolder = new ServletHolder(new ServletContainer());
         servletHolder.setInitParameter(
-                "com.sun.jersey.config.property.packages", rootPackages);
+                ServerProperties.PROVIDER_PACKAGES, rootPackages);
         servletHolder.setInitOrder(1);
         contextHandler.addServlet(servletHolder, config.getBaseURL());
 
diff --git a/core/src/main/java/de/ids_mannheim/korap/service/SearchService.java b/core/src/main/java/de/ids_mannheim/korap/service/SearchService.java
index 6a7d90e..da1924a 100644
--- a/core/src/main/java/de/ids_mannheim/korap/service/SearchService.java
+++ b/core/src/main/java/de/ids_mannheim/korap/service/SearchService.java
@@ -12,6 +12,7 @@
 
 import javax.annotation.PostConstruct;
 import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriBuilder;
 
@@ -24,7 +25,6 @@
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
 
 //import de.ids_mannheim.de.init.VCLoader;
 import de.ids_mannheim.korap.authentication.AuthenticationManager;
@@ -375,7 +375,7 @@
                     "raw not supported!");
         }
 
-        MultivaluedMap<String, String> map = new MultivaluedMapImpl();
+        MultivaluedMap<String, String> map = new MultivaluedHashMap<String, String>();
         map.add("q", query);
         map.add("count", String.valueOf(pageLength));
         map.add("lctxs", String.valueOf(meta.getSpanContext().getLeftSize()));
diff --git a/core/src/main/java/de/ids_mannheim/korap/utils/JerseyUtils.java b/core/src/main/java/de/ids_mannheim/korap/utils/JerseyUtils.java
new file mode 100644
index 0000000..0a8623f
--- /dev/null
+++ b/core/src/main/java/de/ids_mannheim/korap/utils/JerseyUtils.java
@@ -0,0 +1,38 @@
+package de.ids_mannheim.korap.utils;
+
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
+
+import org.glassfish.jersey.message.internal.MediaTypes;
+import org.glassfish.jersey.server.ContainerRequest;
+
+public class JerseyUtils {
+
+    /**
+     * Get the form parameters of the request entity.
+     * <p>
+     * This method will ensure that the request entity is buffered
+     * such that it may be consumed by the application.
+     *
+     * @return the form parameters, if there is a request entity and the
+     * content type is "application/x-www-form-urlencoded", otherwise an
+     * instance containing no parameters will be returned.
+     */
+    public static Form getFormParameters (ContainerRequestContext requestContext) {
+        if (requestContext instanceof ContainerRequest) {
+            return getFormParameters((ContainerRequest) requestContext);
+        }
+        return new Form();
+    }
+
+    private static Form getFormParameters (ContainerRequest request) {
+        if (MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) {
+            request.bufferEntity();
+            Form form = request.readEntity(Form.class);
+            return (form == null ? new Form() : form);
+        } else {
+            return new Form();
+        }
+    }
+}
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java b/core/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
index 0207c54..4ae0a53 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
@@ -1,16 +1,16 @@
 package de.ids_mannheim.korap.web;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.MultivaluedMap;
 import java.net.URI;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author hanl
@@ -19,39 +19,39 @@
 // use for Piotr Ps. rest api connection
 public class ClientsHandler {
 
-    private WebResource service;
+    private WebTarget service;
 
 
     public ClientsHandler (URI address) {
-        ClientConfig config = new DefaultClientConfig();
-        Client client = Client.create(config);
-        this.service = client.resource(address);
+        Client client = ClientBuilder.newClient();
+        this.service = client.target(address);
     }
 
 
     public String getResponse (String path, String key, Object value)
             throws KustvaktException {
-        MultivaluedMap map = new MultivaluedMapImpl();
-        map.add(key, value);
         try {
-            return service.path(path).queryParams(map).get(String.class);
+            return service.path(path).queryParam(key, value).request().get(String.class);
         }
-        catch (UniformInterfaceException e) {
+        catch (WebApplicationException e) {
             throw new KustvaktException(StatusCodes.REQUEST_INVALID);
         }
     }
 
 
-    public String getResponse (MultivaluedMap map, String ... paths)
+    public String getResponse (MultivaluedMap<String, String> map, String ... paths)
             throws KustvaktException {
         try {
-            WebResource resource = service;
+            WebTarget resource = service;
             for (String p : paths)
                 resource = resource.path(p);
-            resource = resource.queryParams(map);
-            return resource.get(String.class);
+            for (Map.Entry<String, List<String>> e : map.entrySet()) {
+                for (String value : e.getValue())
+                    resource = resource.queryParam(e.getKey(), value);
+            }
+            return resource.request().get(String.class);
         }
-        catch (UniformInterfaceException e) {
+        catch (WebApplicationException e) {
             throw new KustvaktException(StatusCodes.REQUEST_INVALID);
         }
     }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/controller/AnnotationController.java b/core/src/main/java/de/ids_mannheim/korap/web/controller/AnnotationController.java
index fd6fd1a..900272c 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/controller/AnnotationController.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/controller/AnnotationController.java
@@ -14,7 +14,7 @@
 import org.springframework.stereotype.Controller;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.dto.FoundryDto;
 import de.ids_mannheim.korap.dto.LayerDto;
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/controller/SearchController.java b/core/src/main/java/de/ids_mannheim/korap/web/controller/SearchController.java
index f19f9c8..18775b2 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/controller/SearchController.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/controller/SearchController.java
@@ -27,7 +27,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.constant.OAuth2Scope;
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/controller/StatisticController.java b/core/src/main/java/de/ids_mannheim/korap/web/controller/StatisticController.java
index 229fb08..7ba31e4 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/controller/StatisticController.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/controller/StatisticController.java
@@ -19,7 +19,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.service.StatisticService;
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/APIVersionFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/APIVersionFilter.java
index db9536d..853557a 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/APIVersionFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/APIVersionFilter.java
@@ -2,17 +2,15 @@
 
 import java.util.List;
 
+import javax.annotation.Priority;
+import javax.ws.rs.NotFoundException;
 import javax.ws.rs.core.PathSegment;
-import javax.ws.rs.ext.Provider;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import com.sun.jersey.api.NotFoundException;
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 
@@ -23,36 +21,24 @@
  *
  */
 @Component
-@Provider
+@Priority(Integer.MIN_VALUE)
 public class APIVersionFilter
-        implements ContainerRequestFilter, ResourceFilter {
+        implements ContainerRequestFilter {
 
     @Autowired
     private KustvaktConfiguration config;
 
-    @Override
-    public ContainerRequestFilter getRequestFilter () {
-        return this;
-    }
-
-    @Override
-    public ContainerResponseFilter getResponseFilter () {
-        return null;
-    }
-
-    @Override
-    public ContainerRequest filter (ContainerRequest request) {
-        List<PathSegment> pathSegments = request.getPathSegments();
+    public void filter (ContainerRequestContext request) {
+        List<PathSegment> pathSegments = request.getUriInfo().getPathSegments();
         String version = pathSegments.get(0).getPath();
 
         if (!config.getSupportedVersions().contains(version)) {
-            throw new NotFoundException(request.getRequestUri());
+            throw new NotFoundException();
             // throw kustvaktResponseHandler.throwit(
             // new
             // KustvaktException(StatusCodes.UNSUPPORTED_API_VERSION,
             // "API " + version + " is unsupported.", version));
         }
-        return request;
     }
 
 }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/AdminFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/AdminFilter.java
index dd794b4..1201529 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/AdminFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/AdminFilter.java
@@ -1,21 +1,20 @@
 package de.ids_mannheim.korap.web.filter;
 
+import javax.annotation.Priority;
 import javax.servlet.ServletContext;
+import javax.ws.rs.Priorities;
+import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.SecurityContext;
-import javax.ws.rs.ext.Provider;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-
 import de.ids_mannheim.korap.dao.AdminDao;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.security.context.TokenContext;
+import de.ids_mannheim.korap.utils.JerseyUtils;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
 
 /**
@@ -24,7 +23,7 @@
  * @see {@link AuthenticationFilter}
  */
 @Component
-@Provider
+@Priority(Priorities.AUTHENTICATION)
 public class AdminFilter extends AuthenticationFilter {
 
     private @Context ServletContext servletContext;
@@ -34,45 +33,33 @@
     private KustvaktResponseHandler kustvaktResponseHandler;
 
     @Override
-    public ContainerRequest filter (ContainerRequest request) {
-        ContainerRequest superRequest = super.filter(request);
+    public void filter (ContainerRequestContext context) {
+        super.filter(context);
         String username = "guest";
         
         // legacy support for kustvakt core
-        String adminToken = superRequest.getFormParameters().getFirst("token");
+        String adminToken = JerseyUtils.getFormParameters(context).asMap().getFirst("token");
         if (adminToken != null && !adminToken.isEmpty()) {
             // startswith token=
             // adminToken = adminToken.substring(6);
             if (adminToken
                     .equals(servletContext.getInitParameter("adminToken"))) {
-                return superRequest;
+                return;
             }
         }
 
-        SecurityContext securityContext = superRequest.getSecurityContext();
+        SecurityContext securityContext = context.getSecurityContext();
         TokenContext tokenContext = (TokenContext) securityContext
                 .getUserPrincipal();
         
         if (tokenContext != null) {
             username = tokenContext.getUsername();
             if (adminDao.isAdmin(username)) {
-                return superRequest;
+                return;
             }
         }
         throw kustvaktResponseHandler.throwit(new KustvaktException(
                 StatusCodes.AUTHORIZATION_FAILED,
                 "Unauthorized operation for user: " + username, username));
     }
-
-
-    @Override
-    public ContainerRequestFilter getRequestFilter () {
-        return this;
-    }
-
-
-    @Override
-    public ContainerResponseFilter getResponseFilter () {
-        return null;
-    }
 }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/AuthenticationFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/AuthenticationFilter.java
index 1f54669..4b5e471 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/AuthenticationFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/AuthenticationFilter.java
@@ -1,14 +1,13 @@
 package de.ids_mannheim.korap.web.filter;
 
-import javax.ws.rs.ext.Provider;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.glassfish.jersey.server.ContainerRequest;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
+import javax.annotation.Priority;
+import javax.ws.rs.Priorities;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
 
 import de.ids_mannheim.korap.authentication.AuthenticationManager;
 import de.ids_mannheim.korap.authentication.http.AuthorizationData;
@@ -31,9 +30,9 @@
  * @last update 12/2017
  */
 @Component
-@Provider
+@Priority(Priorities.AUTHENTICATION)
 public class AuthenticationFilter
-        implements ContainerRequestFilter, ResourceFilter {
+        implements ContainerRequestFilter {
 
     @Autowired
     private HttpAuthorizationHandler authorizationHandler;
@@ -45,12 +44,12 @@
     private KustvaktResponseHandler kustvaktResponseHandler;
 
     @Override
-    public ContainerRequest filter (ContainerRequest request) {
-        String host = request.getHeaderValue(ContainerRequest.HOST);
-        String ua = request.getHeaderValue(ContainerRequest.USER_AGENT);
+    public void filter (ContainerRequestContext request) {
+        String host = request.getHeaderString(ContainerRequest.HOST);
+        String ua = request.getHeaderString(ContainerRequest.USER_AGENT);
 
         String authorization =
-                request.getHeaderValue(ContainerRequest.AUTHORIZATION);
+                request.getHeaderString(ContainerRequest.AUTHORIZATION);
 
         if (authorization != null && !authorization.isEmpty()) {
             TokenContext context = null;
@@ -97,11 +96,10 @@
                 throw kustvaktResponseHandler.throwit(e);
             }
         }
-        return request;
     }
 
 
-    private void checkContext (TokenContext context, ContainerRequest request)
+    private void checkContext (TokenContext context, ContainerRequestContext request)
             throws KustvaktException {
         if (context == null) {
             throw new KustvaktException(StatusCodes.AUTHENTICATION_FAILED,
@@ -112,7 +110,7 @@
                     "Context is not valid: "
                             + "missing username, password or authentication scheme.");
         }
-        else if (context.isSecureRequired() && !request.isSecure()) {
+        else if (context.isSecureRequired() && !request.getSecurityContext().isSecure()) {
             throw new KustvaktException(StatusCodes.AUTHENTICATION_FAILED,
                     "Request is not secure.");
         }
@@ -121,16 +119,4 @@
                     "Access token is expired");
         }
     }
-
-
-    @Override
-    public ContainerRequestFilter getRequestFilter () {
-        return this;
-    }
-
-
-    @Override
-    public ContainerResponseFilter getResponseFilter () {
-        return null;
-    }
 }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
index 8375b62..bb14e10 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
@@ -1,14 +1,13 @@
 package de.ids_mannheim.korap.web.filter;
 
-import javax.ws.rs.ext.Provider;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
+import javax.annotation.Priority;
+import javax.ws.rs.Priorities;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.core.SecurityContext;
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
@@ -23,22 +22,23 @@
  *       anonymous access should be allowed!
  */
 @Component
-@Provider
-public class BlockingFilter implements ContainerRequestFilter, ResourceFilter {
+@Priority(Priorities.AUTHORIZATION)
+public class BlockingFilter implements ContainerRequestFilter {
 
     @Autowired
     private KustvaktResponseHandler kustvaktResponseHandler;
 
     @Override
-    public ContainerRequest filter (ContainerRequest request) {
+    public void filter (ContainerRequestContext request) {
         TokenContext context;
 
-        try {
-            context = (TokenContext) request.getUserPrincipal();
+        SecurityContext securityContext = request.getSecurityContext();
+        if (securityContext != null) {
+            context = (TokenContext) securityContext.getUserPrincipal();
         }
-        catch (UnsupportedOperationException e) {
+        else {
             throw kustvaktResponseHandler.throwit(new KustvaktException(
-                    StatusCodes.UNSUPPORTED_OPERATION, e.getMessage(), e));
+                    StatusCodes.UNSUPPORTED_OPERATION));
         }
 
         if (context == null || context.isDemo()) {
@@ -46,20 +46,5 @@
                     StatusCodes.AUTHORIZATION_FAILED,
                     "Unauthorized operation for user: guest", "guest"));
         }
-
-
-        return request;
-    }
-
-
-    @Override
-    public ContainerRequestFilter getRequestFilter () {
-        return this;
-    }
-
-
-    @Override
-    public ContainerResponseFilter getResponseFilter () {
-        return null;
     }
 }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/DemoFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/DemoFilter.java
index b15f5e3..e020a8d 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/DemoFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/DemoFilter.java
@@ -1,12 +1,12 @@
 package de.ids_mannheim.korap.web.filter;
 
+import javax.annotation.Priority;
+import javax.ws.rs.Priorities;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.core.SecurityContext;
-import javax.ws.rs.ext.Provider;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
+import org.glassfish.jersey.server.ContainerRequest;
 
 import de.ids_mannheim.korap.authentication.http.HttpAuthorizationHandler;
 import de.ids_mannheim.korap.constant.TokenType;
@@ -18,22 +18,18 @@
  * @author hanl
  * @date 08/02/2016
  */
-@Provider
-public class DemoFilter implements ContainerRequestFilter, ResourceFilter {
+@Priority(Priorities.AUTHENTICATION)
+public class DemoFilter implements ContainerRequestFilter {
 
     @Override
-    public ContainerRequest filter (ContainerRequest request) {
+    public void filter (ContainerRequestContext request) {
         String authentication =
-                request.getHeaderValue(ContainerRequest.AUTHORIZATION);
+                request.getHeaderString(ContainerRequest.AUTHORIZATION);
         if (authentication == null || authentication.isEmpty()) {
-            try {
-                request.getUserPrincipal();
-            }
-            catch (UnsupportedOperationException e) {
+            if (request.getSecurityContext() == null) {
                 request.setSecurityContext(createContext());
             }
         }
-        return request;
     }
 
 
@@ -52,16 +48,4 @@
         context.setUsername("demo");
         return new KustvaktContext(context);
     }
-
-
-    @Override
-    public ContainerRequestFilter getRequestFilter () {
-        return this;
-    }
-
-
-    @Override
-    public ContainerResponseFilter getResponseFilter () {
-        return null;
-    }
 }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/DemoUserFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/DemoUserFilter.java
index e546c12..f24f957 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/DemoUserFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/DemoUserFilter.java
@@ -2,17 +2,18 @@
 
 import java.security.Principal;
 
+import javax.annotation.Priority;
+import javax.ws.rs.Priorities;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.core.UriInfo;
-import javax.ws.rs.ext.Provider;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
+import org.glassfish.jersey.server.ContainerRequest;
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.constant.TokenType;
@@ -24,9 +25,9 @@
 /**
  * Created by hanl on 7/15/14.
  */
-@Provider
 @Component
-public class DemoUserFilter implements ContainerRequestFilter, ResourceFilter {
+@Priority(Priorities.AUTHENTICATION)
+public class DemoUserFilter implements ContainerRequestFilter {
 
     @Context
     UriInfo info;
@@ -35,27 +36,23 @@
 
 
     @Override
-    public ContainerRequest filter (ContainerRequest request) {
-        String host = request.getHeaderValue(ContainerRequest.HOST);
-        String ua = request.getHeaderValue(ContainerRequest.USER_AGENT);
+    public void filter (ContainerRequestContext request) {
+        String host = request.getHeaderString(ContainerRequest.HOST);
+        String ua = request.getHeaderString(ContainerRequest.USER_AGENT);
         String authentication = request
-                .getHeaderValue(ContainerRequest.AUTHORIZATION);
+                .getHeaderString(ContainerRequest.AUTHORIZATION);
 
         // means that this is the public service
         if (authentication == null || authentication.isEmpty()) {
             Principal pr = null;
-            try {
-                pr = request.getUserPrincipal();
-            }
-            catch (UnsupportedOperationException e) {
-                // do nothing
+            SecurityContext securityContext = request.getSecurityContext();
+            if (securityContext != null) {
+                pr = securityContext.getUserPrincipal();
             }
             if (pr == null)
                 request.setSecurityContext(new KustvaktContext(
                         createShorterToken(host, ua)));
-
         }
-        return request;
     }
 
 
@@ -71,16 +68,4 @@
         c.setTokenType(TokenType.BASIC);
         return c;
     }
-
-
-    @Override
-    public ContainerRequestFilter getRequestFilter () {
-        return this;
-    }
-
-
-    @Override
-    public ContainerResponseFilter getResponseFilter () {
-        return null;
-    }
 }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/NonDemoBlockingFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/NonDemoBlockingFilter.java
index 47cd086..c4b539a 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/NonDemoBlockingFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/NonDemoBlockingFilter.java
@@ -1,14 +1,13 @@
 package de.ids_mannheim.korap.web.filter;
 
-import javax.ws.rs.ext.Provider;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
+import javax.annotation.Priority;
+import javax.ws.rs.Priorities;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.core.SecurityContext;
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
@@ -25,22 +24,23 @@
  *       anonymous access should be allowed!
  */
 @Component
-@Provider
+@Priority(Priorities.AUTHORIZATION)
 public class NonDemoBlockingFilter
-        implements ContainerRequestFilter, ResourceFilter {
+        implements ContainerRequestFilter {
 
     @Autowired
     private KustvaktResponseHandler kustvaktResponseHandler;
 
     @Override
-    public ContainerRequest filter (ContainerRequest request) {
+    public void filter (ContainerRequestContext request) {
         TokenContext context;
-        try {
-            context = (TokenContext) request.getUserPrincipal();
+        SecurityContext securityContext = request.getSecurityContext();
+        if (securityContext != null) {
+            context = (TokenContext) securityContext.getUserPrincipal();
         }
-        catch (UnsupportedOperationException e) {
+        else {
             throw kustvaktResponseHandler.throwit(new KustvaktException(
-                    StatusCodes.UNSUPPORTED_OPERATION, e.getMessage(), e));
+                    StatusCodes.UNSUPPORTED_OPERATION));
         }
 
         if (context == null || context.isDemo()) {
@@ -48,18 +48,5 @@
                     new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
                             "Operation is not permitted for guest users"));
         }
-        return request;
-    }
-
-
-    @Override
-    public ContainerRequestFilter getRequestFilter () {
-        return this;
-    }
-
-
-    @Override
-    public ContainerResponseFilter getResponseFilter () {
-        return null;
     }
 }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
index 88fde0d..5a9f19a 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
@@ -8,25 +8,25 @@
 import java.util.Map;
 import java.util.Random;
 
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.ext.Provider;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.client.filter.LoggingFilter;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
+import javax.annotation.Priority;
+import javax.ws.rs.Priorities;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.logging.LoggingFeature;
 
 import de.ids_mannheim.korap.authentication.AuthenticationManager;
 import de.ids_mannheim.korap.config.Attributes;
@@ -42,10 +42,10 @@
  * @date 13/05/2014
  */
 @Component
-@Provider
-public class PiwikFilter implements ContainerRequestFilter, ResourceFilter {
+@Priority(Priorities.AUTHORIZATION)
+public class PiwikFilter implements ContainerRequestFilter {
 
-    private WebResource service;
+    private WebTarget service;
     //    private static final String SERVICE = "http://localhost:8888";
     private static final String SERVICE = "http://10.0.10.13";
     private static Logger jlog = LogManager.getLogger(PiwikFilter.class);
@@ -58,28 +58,18 @@
     public PiwikFilter () {
 //        controller = BeansFactory.getKustvaktContext()
 //                .getAuthenticationManager();
-        ClientConfig config = new DefaultClientConfig();
-        Client client = Client.create(config);
+        ClientConfig clientConfig = new ClientConfig();
         if (jlog.isDebugEnabled())
-            client.addFilter(new LoggingFilter());
+            clientConfig.register(LoggingFeature.class);
+        Client client = ClientBuilder.newClient(clientConfig);
         UriBuilder b = UriBuilder.fromUri(SERVICE);
-        service = client.resource(b.build());
+        service = client.target(b.build());
         this.customVars = new HashMap<>();
     }
 
 
-    private void send (ContainerRequest request) {
+    private void send (ContainerRequestContext request) {
         Random random = new SecureRandom();
-        MultivaluedMap<String, String> params = new MultivaluedMapImpl();
-        params.add("idsite", "2");
-        params.add("rec", "1");
-        if (!customVars.isEmpty())
-            params.add("_cvar", translateCustomData());
-        params.add("cip", request.getHeaderValue("Host"));
-        params.add("cookie", "false");
-        params.add("r", String.valueOf(random.nextDouble()));
-        params.add("action_name", request.getRequestUri().toASCIIString());
-
         Locale l = null;
         if (request.getAcceptableLanguages() != null)
             l = request.getAcceptableLanguages().get(0);
@@ -89,14 +79,15 @@
                     .queryParam("rec", "1")
                     //todo check for empty container
                     .queryParam("_cvar", translateCustomData())
-                    .queryParam("cip", request.getHeaderValue("Host"))
+                    .queryParam("cip", request.getHeaderString("Host"))
                     .queryParam("cookie", "false")
                     .queryParam("r", String.valueOf(random.nextDouble()))
                     .queryParam("action_name",
-                            request.getRequestUri().toASCIIString())
-                    .queryParams(params).accept("text/html")
-                    .header("Host", request.getHeaderValue("Host"))
-                    .header("User-Agent", request.getHeaderValue("User-Agent"))
+                            request.getUriInfo().getRequestUri().toASCIIString())
+                    .request()
+                    .accept("text/html")
+                    .header("Host", request.getHeaderString("Host"))
+                    .header("User-Agent", request.getHeaderString("User-Agent"))
                     .acceptLanguage(l).method("GET");
         }
         catch (Exception e) {
@@ -128,37 +119,28 @@
 
 
     @Override
-    public ContainerRequest filter (ContainerRequest request) {
+    public void filter (ContainerRequestContext request) {
         if (ENABLED) {
             try {
-                TokenContext context = (TokenContext) request
-                        .getUserPrincipal();
-                if (context.getUsername() != null){
-                    // since this is cached, not very expensive!
-                    User user = authenticationManager.getUser(context.getUsername());
-                    Userdata data = authenticationManager
-                            .getUserData(user, UserSettingProcessor.class);
-                    if ((Boolean) data.get(Attributes.COLLECT_AUDITING_DATA))
-                        customVars.put("username", context.getUsername());
+                TokenContext context;
+                SecurityContext securityContext = request.getSecurityContext();
+                if (securityContext != null) {
+                    context = (TokenContext) securityContext.getUserPrincipal();
+
+                    if (context.getUsername() != null){
+                        // since this is cached, not very expensive!
+                        User user = authenticationManager.getUser(context.getUsername());
+                        Userdata data = authenticationManager
+                                .getUserData(user, UserSettingProcessor.class);
+                        if ((Boolean) data.get(Attributes.COLLECT_AUDITING_DATA))
+                            customVars.put("username", context.getUsername());
+                    }
                 }
             }
-            catch (KustvaktException | UnsupportedOperationException e) {
+            catch (KustvaktException e) {
                 //do nothing
             }
             send(request);
         }
-        return request;
-    }
-
-
-    @Override
-    public ContainerRequestFilter getRequestFilter () {
-        return this;
-    }
-
-
-    @Override
-    public ContainerResponseFilter getResponseFilter () {
-        return null;
     }
 }
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/utils/LocaleFactory.java b/core/src/main/java/de/ids_mannheim/korap/web/utils/LocaleFactory.java
new file mode 100644
index 0000000..cb72ba5
--- /dev/null
+++ b/core/src/main/java/de/ids_mannheim/korap/web/utils/LocaleFactory.java
@@ -0,0 +1,25 @@
+package de.ids_mannheim.korap.web.utils;
+
+import org.glassfish.hk2.api.Factory;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.ext.Provider;
+import java.util.List;
+import java.util.Locale;
+
+@Provider
+public class LocaleFactory implements Factory<Locale> {
+    @Context
+    private ContainerRequestContext context;
+
+    @Override
+    public Locale provide() {
+        final List<Locale> locales = context.getAcceptableLanguages();
+        if (locales.isEmpty())
+            return Locale.US;
+        return locales.get(0);
+    }
+
+    @Override
+    public void dispose(Locale instance) {}
+}
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java b/core/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java
deleted file mode 100644
index cb76260..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package de.ids_mannheim.korap.web.utils;
-
-import com.sun.jersey.api.core.HttpContext;
-import com.sun.jersey.core.spi.component.ComponentContext;
-import com.sun.jersey.core.spi.component.ComponentScope;
-import com.sun.jersey.server.impl.inject.AbstractHttpContextInjectable;
-import com.sun.jersey.spi.inject.Injectable;
-import com.sun.jersey.spi.inject.InjectableProvider;
-
-import javax.ws.rs.core.Context;
-import javax.ws.rs.ext.Provider;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * @author hanl
- * @date 04/02/2014
- */
-@Provider
-public class LocaleProvider extends AbstractHttpContextInjectable<Locale>
-        implements InjectableProvider<Context, Type> {
-
-    @Override
-    public Locale getValue (HttpContext httpContext) {
-        final List<Locale> locales = httpContext.getRequest()
-                .getAcceptableLanguages();
-        if (locales.isEmpty())
-            return Locale.US;
-        return locales.get(0);
-    }
-
-
-    @Override
-    public ComponentScope getScope () {
-        return ComponentScope.PerRequest;
-    }
-
-
-    @Override
-    public Injectable getInjectable (ComponentContext ic, Context context,
-            Type type) {
-        if (type.equals(Locale.class))
-            return this;
-        return null;
-    }
-}
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/utils/NotFoundMapper.java b/core/src/main/java/de/ids_mannheim/korap/web/utils/NotFoundMapper.java
index d2536f6..a05983b 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/utils/NotFoundMapper.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/utils/NotFoundMapper.java
@@ -4,6 +4,10 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ResourceContext;
+import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.ext.ExceptionMapper;
@@ -15,8 +19,6 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import com.sun.jersey.api.NotFoundException;
-
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 
 /**
@@ -38,9 +40,15 @@
     @Autowired
     private KustvaktConfiguration config;
 
+    @Context
+    private ResourceContext resourceContext;
+
     @Override
     public Response toResponse (NotFoundException exception) {
-        URI notFoundUri = exception.getNotFoundUri();
+        ContainerRequestContext requestContext =
+                resourceContext.getResource(ContainerRequestContext.class);
+
+    	URI notFoundUri = requestContext.getUriInfo().getRequestUri();
 
         String path = notFoundUri.getPath();
         String baseUrl = config.getBaseURL();
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/utils/ResourceFilters.java b/core/src/main/java/de/ids_mannheim/korap/web/utils/ResourceFilters.java
new file mode 100644
index 0000000..ab0d4ea
--- /dev/null
+++ b/core/src/main/java/de/ids_mannheim/korap/web/utils/ResourceFilters.java
@@ -0,0 +1,23 @@
+package de.ids_mannheim.korap.web.utils;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Defines the list of {@link javax.ws.rs.container.ContainerRequestFilter}
+ * and {@link javax.ws.rs.container.ContainerResponseFilter}
+ * classes associated with a resource method.
+ * <p>
+ * This annotation can be specified on a class or on method(s). Specifying it
+ * at a class level means that it applies to all the methods in the class.
+ * Specifying it on a method means that it is applicable to that method only.
+ * If applied at both the class and methods level , the method value overrides
+ * the class value.
+ */
+@Target({ ElementType.TYPE, ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ResourceFilters {
+    Class<?>[] value();
+}
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/utils/ResourceFiltersFeature.java b/core/src/main/java/de/ids_mannheim/korap/web/utils/ResourceFiltersFeature.java
new file mode 100644
index 0000000..62b7745
--- /dev/null
+++ b/core/src/main/java/de/ids_mannheim/korap/web/utils/ResourceFiltersFeature.java
@@ -0,0 +1,27 @@
+package de.ids_mannheim.korap.web.utils;
+
+import javax.ws.rs.container.DynamicFeature;
+import javax.ws.rs.container.ResourceInfo;
+import javax.ws.rs.core.FeatureContext;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * Registers {@link javax.ws.rs.container.ContainerRequestFilter}
+ * and {@link javax.ws.rs.container.ContainerResponseFilter}
+ * classes for a resource method annotated with {@link ResourceFilters}.
+ */
+@Provider
+public class ResourceFiltersFeature implements DynamicFeature {
+
+    @Override
+    public void configure (ResourceInfo resourceInfo, FeatureContext context) {
+        ResourceFilters filtersAnnotation = resourceInfo.getResourceMethod().getAnnotation(ResourceFilters.class);
+        if (filtersAnnotation == null)
+            filtersAnnotation = resourceInfo.getResourceClass().getAnnotation(ResourceFilters.class);
+
+        if (filtersAnnotation != null) {
+            for (Class<?> filter : filtersAnnotation.value())
+                context.register(filter);
+        }
+    }
+}
diff --git a/full/pom.xml b/full/pom.xml
index 251af08..ea2a353 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -5,9 +5,9 @@
 	<artifactId>Kustvakt-full</artifactId>
 	<version>0.68</version>
 	<properties>
-		<java.version>1.8</java.version>
+		<java.version>11</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<jersey.version>1.19.4</jersey.version>
+		<jersey.version>2.37</jersey.version>
 		<hibernate.version>5.6.14.Final</hibernate.version>
 	</properties>
 	<profiles>
@@ -216,14 +216,14 @@
 
 		<!-- Jersey -->
 		<dependency>
-			<groupId>com.sun.jersey.jersey-test-framework</groupId>
+			<groupId>org.glassfish.jersey.test-framework</groupId>
 			<artifactId>jersey-test-framework-core</artifactId>
 			<version>${jersey.version}</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>com.sun.jersey.jersey-test-framework</groupId>
-			<artifactId>jersey-test-framework-grizzly</artifactId>
+			<groupId>org.glassfish.jersey.test-framework.providers</groupId>
+			<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
 			<version>${jersey.version}</version>
 			<scope>test</scope>
 		</dependency>
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/main/java/de/ids_mannheim/korap/web/controller/AdminController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/AdminController.java
index 97dbbcd..f3dac49 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/AdminController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/AdminController.java
@@ -17,7 +17,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.auditing.AuditRecord;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
index bca7dc2..e061644 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
@@ -26,8 +26,8 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ResourceFilters;
+import org.glassfish.jersey.server.ContainerRequest;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.authentication.AuthenticationManager;
 import de.ids_mannheim.korap.authentication.http.AuthorizationData;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2AdminController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2AdminController.java
index 7935098..1ab9d06 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2AdminController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2AdminController.java
@@ -13,7 +13,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
index 8ea0f37..0efcbbe 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
@@ -27,7 +27,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2WithOpenIdController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2WithOpenIdController.java
index a1e9fa7..685bb3f 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2WithOpenIdController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2WithOpenIdController.java
@@ -30,7 +30,7 @@
 import com.nimbusds.oauth2.sdk.TokenRequest;
 import com.nimbusds.oauth2.sdk.http.HTTPRequest.Method;
 import com.nimbusds.oauth2.sdk.id.State;
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
index 8ffc164..7e4b75e 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
@@ -18,7 +18,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.dto.InstalledPluginDto;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/PluginController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/PluginController.java
index 581b325..d377da3 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/PluginController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/PluginController.java
@@ -15,7 +15,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.dto.InstalledPluginDto;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
index 36ed830..012bc97 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
@@ -19,7 +19,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.constant.QueryType;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
index bee5a3d..9e01afe 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
@@ -10,7 +10,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.dto.ResourceDto;
 import de.ids_mannheim.korap.service.ResourceService;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/ShibbolethUserController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/ShibbolethUserController.java
index 79ba584..ce7ba2b 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/ShibbolethUserController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/ShibbolethUserController.java
@@ -28,7 +28,7 @@
 import org.springframework.stereotype.Controller;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.authentication.AuthenticationManager;
 import de.ids_mannheim.korap.config.Attributes;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
index 415d98d..efab410 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
@@ -21,7 +21,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.constant.UserGroupStatus;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserSettingController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserSettingController.java
index a4d7303..3ff57a7 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserSettingController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserSettingController.java
@@ -17,7 +17,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
index bc3c06f..a0019cf 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
@@ -21,7 +21,7 @@
 import org.springframework.stereotype.Controller;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.spi.container.ResourceFilters;
+import de.ids_mannheim.korap.web.utils.ResourceFilters;
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.constant.QueryType;
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 37db9b4..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,12 +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 48f6193..638e8b9 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;
@@ -19,9 +20,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.ProcessingException;
+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 +80,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 +96,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());
 
         
@@ -118,7 +119,7 @@
     }
     
     private void testRegisterPublicClient (String accessToken)
-            throws ClientHandlerException, UniformInterfaceException,
+            throws ProcessingException,
             KustvaktException {
         OAuth2ClientJson json = new OAuth2ClientJson();
         json.setName("LDAP test client");
@@ -126,13 +127,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();
@@ -141,7 +143,7 @@
     }
     
     private JsonNode testRegisterConfidentialClient (String accessToken)
-            throws ClientHandlerException, UniformInterfaceException,
+            throws ProcessingException,
             KustvaktException {
         OAuth2ClientJson json = new OAuth2ClientJson();
         json.setName("LDAP test client");
@@ -150,13 +152,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();
@@ -168,13 +171,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());
@@ -185,7 +189,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/config/SpringJerseyTest.java b/full/src/test/java/de/ids_mannheim/korap/config/SpringJerseyTest.java
index ac11283..0ce1c11 100644
--- a/full/src/test/java/de/ids_mannheim/korap/config/SpringJerseyTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/config/SpringJerseyTest.java
@@ -1,9 +1,5 @@
 package de.ids_mannheim.korap.config;
 
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.concurrent.ThreadLocalRandom;
-
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.support.GenericApplicationContext;
@@ -11,15 +7,14 @@
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.web.context.support.GenericWebApplicationContext;
 
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import com.sun.jersey.test.framework.spi.container.TestContainerException;
-import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletContainer;
+import org.glassfish.jersey.test.DeploymentContext;
+import org.glassfish.jersey.test.JerseyTest;
+import org.glassfish.jersey.test.ServletDeploymentContext;
+import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
+import org.glassfish.jersey.test.spi.TestContainerException;
+import org.glassfish.jersey.test.spi.TestContainerFactory;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration("classpath:test-config.xml")
@@ -55,32 +50,11 @@
     }
 
     @Override
-    protected AppDescriptor configure () {
-        // Simulation of the production server 
-        // Indicate to use codehaus jackson
-        ClientConfig config = new DefaultClientConfig();
-        config.getFeatures().put("com.sun.jersey.api.json.POJOMappingFeature", true);
-        
-        return new WebAppDescriptor.Builder(classPackages)
-                .servletClass(SpringServlet.class)
-                .contextListenerClass(StaticContextLoaderListener.class)
+    protected DeploymentContext configureDeployment() {
+        return ServletDeploymentContext
+                .forServlet(new ServletContainer(new ResourceConfig().packages(classPackages)))
+                .addListener(StaticContextLoaderListener.class)
                 .contextParam("adminToken", "secret")
                 .build();
     }
-
-    @Override
-    protected int getPort (int defaultPort) {
-        int port = ThreadLocalRandom.current().nextInt(5000, 8000 + 1);
-        try {
-            ServerSocket socket = new ServerSocket(port);
-            socket.close();
-        }
-        catch (IOException e) {
-//            e.printStackTrace();
-            System.out.println("[WARNING] " + e.getMessage());
-            port = getPort(port);
-        }
-        return port;
-    }
-
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/config/StaticContextLoaderListener.java b/full/src/test/java/de/ids_mannheim/korap/config/StaticContextLoaderListener.java
index 578c94e..5dd00a0 100644
--- a/full/src/test/java/de/ids_mannheim/korap/config/StaticContextLoaderListener.java
+++ b/full/src/test/java/de/ids_mannheim/korap/config/StaticContextLoaderListener.java
@@ -1,5 +1,7 @@
 package de.ids_mannheim.korap.config;
 
+import javax.servlet.ServletContextEvent;
+
 import org.springframework.web.context.ContextLoaderListener;
 import org.springframework.web.context.WebApplicationContext;
 
@@ -14,9 +16,31 @@
 
     public static WebApplicationContext applicationContext;
 
+    private ClassLoader contextClassLoader;
+
     public StaticContextLoaderListener () {
         super(applicationContext);
     }
 
+	@Override
+	public void contextInitialized(ServletContextEvent event) {
+        contextClassLoader = Thread.currentThread().getContextClassLoader();
+        super.contextInitialized(event);
+	}
 
+	@Override
+	public void contextDestroyed(ServletContextEvent event) {
+        // Perform the destruction with the same contextual ClassLoader that was present
+        // during initialization.
+        // This a workaround for a bug in org.glassfish.grizzly.servlet.WebappContext
+        // that causes a memory leak in org.springframework.web.context.ContextLoader.
+        // This logic should be moved to WebappContext.contextDestroyed(). Until this
+        // is fixed in Grizzly; This is a good solution.
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(contextClassLoader);
+
+        super.contextDestroyed(event);
+
+        Thread.currentThread().setContextClassLoader(loader);
+	}
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/misc/MapUtilsTest.java b/full/src/test/java/de/ids_mannheim/korap/misc/MapUtilsTest.java
index 4a7317b..f302f31 100644
--- a/full/src/test/java/de/ids_mannheim/korap/misc/MapUtilsTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/misc/MapUtilsTest.java
@@ -4,12 +4,11 @@
 
 import java.util.Map;
 
+import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
 
 import org.junit.Test;
 
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-
 import de.ids_mannheim.korap.web.utils.MapUtils;
 import edu.emory.mathcs.backport.java.util.Arrays;
 
@@ -18,7 +17,7 @@
     @SuppressWarnings("unchecked")
     @Test
     public void testConvertToMap () {
-        MultivaluedMap<String, String> mm = new MultivaluedMapImpl();
+        MultivaluedMap<String, String> mm = new MultivaluedHashMap<String, String>();
         mm.put("k1", Arrays.asList(new String[] { "a", "b", "c" }));
         mm.put("k2", Arrays.asList(new String[] { "d", "e", "f" }));
 
@@ -35,7 +34,7 @@
 
     @Test
     public void testConvertEmptyMap () {
-        MultivaluedMap<String, String> mm = new MultivaluedMapImpl();
+        MultivaluedMap<String, String> mm = new MultivaluedHashMap<String, String>();
         Map<String, String> map = MapUtils.toMap(mm);
         assertEquals(0, map.size());
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
index ce2f6ad..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,25 +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 dd7e295..130741d 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,12 +23,14 @@
     public void testRewriteRefNotFound ()
             throws KustvaktException, Exception {
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
-            .queryParam("q", "[orth=der]{%23examplequery} Baum")
+        Response response = target().path(API_VERSION).path("search")
+            .queryParam("q", "{q}")
             .queryParam("ql", "poliqarp")
-            .get(ClientResponse.class);
+            .resolveTemplate("q", "[orth=der]{#examplequery} Baum")
+            .request()
+            .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());
@@ -38,12 +40,14 @@
     public void testRewriteSystemQuery ()
             throws KustvaktException, Exception {
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
-            .queryParam("q", "[orth=der]{%23system-q} Baum")
+        Response response = target().path(API_VERSION).path("search")
+            .queryParam("q", "{q}")
             .queryParam("ql", "poliqarp")
-            .get(ClientResponse.class);
+            .resolveTemplate("q", "[orth=der]{#system-q} Baum")
+            .request()
+            .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
 //        System.out.println(ent);
         JsonNode node = JsonUtils.readTree(ent);
     }
@@ -53,14 +57,16 @@
             throws KustvaktException, Exception {
 
         // Added in the database migration sql for tests
-        ClientResponse response = resource().path(API_VERSION).path("search")
-            .queryParam("q", "[orth=der]{%23dory/dory-q} Baum")
+        Response response = target().path(API_VERSION).path("search")
+            .queryParam("q", "{q}")
             .queryParam("ql", "poliqarp")
+            .resolveTemplate("q", "[orth=der]{#dory/dory-q} Baum")
+            .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 4d2f684..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,12 +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")
-                .get(ClientResponse.class);
+                .request()
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         node = node.at("/collection");
 
@@ -67,12 +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\"")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -87,12 +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\"")
-                .get(ClientResponse.class);
+                .request()
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         node = node.at("/collection");
 
@@ -112,15 +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());
@@ -137,14 +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 87d62ad..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,9 +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")
-                .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+                .request()
+                .accept(MediaType.APPLICATION_JSON).get();
         assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
         URI location = response.getLocation();
         assertEquals("/api/"+API_VERSION+"/search", location.getPath());
@@ -32,10 +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").accept(MediaType.APPLICATION_JSON)
-                .get(ClientResponse.class);
+                .queryParam("ql", "poliqarp")
+                .request()
+                .accept(MediaType.APPLICATION_JSON)
+                .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/FastJerseyTest.java b/full/src/test/java/de/ids_mannheim/korap/web/FastJerseyTest.java
index a22ded4..ae9a2ef 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/FastJerseyTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/FastJerseyTest.java
@@ -3,6 +3,7 @@
 import java.net.URI;
 import java.util.concurrent.ThreadLocalRandom;
 
+import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.UriBuilder;
 
 import org.junit.After;
@@ -10,17 +11,16 @@
 import org.junit.BeforeClass;
 import org.springframework.web.context.ContextLoaderListener;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.core.DefaultResourceConfig;
-import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.LowLevelAppDescriptor;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import com.sun.jersey.test.framework.spi.container.TestContainer;
-import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import com.sun.jersey.test.framework.spi.container.grizzly.GrizzlyTestContainerFactory;
-import com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletContainer;
+import org.glassfish.jersey.test.DeploymentContext;
+import org.glassfish.jersey.test.ServletDeploymentContext;
+import org.glassfish.jersey.test.spi.TestContainer;
+import org.glassfish.jersey.test.spi.TestContainerFactory;
+import org.glassfish.jersey.test.grizzly.GrizzlyTestContainerFactory;
+import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
 
 import de.ids_mannheim.korap.config.BeanConfigTest;
 
@@ -33,14 +33,14 @@
 
     public final static String API_VERSION = "v0.1";
 
-    private static DefaultResourceConfig resourceConfig =
-            new DefaultResourceConfig();
+    private static ResourceConfig resourceConfig =
+            new ResourceConfig();
 
     private static TestContainerFactory testContainerFactory;
 
     protected static TestContainer testContainer;
 
-    protected static Client client;
+    protected static javax.ws.rs.client.Client client;
 
     protected static int PORT = 8089; // FB, was: 9000;
     protected static int PORT_IT = 1;
@@ -58,18 +58,18 @@
 
     @BeforeClass
     public static void cleanStaticVariables () {
-        resourceConfig = new DefaultResourceConfig();
+        resourceConfig = new ResourceConfig();
     }
 
 
     protected static void initServer (int port, String[] classPackages) {
-        AppDescriptor ad;
+        DeploymentContext dc;
         if (classPackages == null)
-            ad = new LowLevelAppDescriptor.Builder(resourceConfig).build();
+            dc = DeploymentContext.builder(resourceConfig).build();
         else
-            ad = new WebAppDescriptor.Builder(classPackages)
-                    .servletClass(SpringServlet.class)
-                    .contextListenerClass(ContextLoaderListener.class)
+            dc = ServletDeploymentContext
+                    .forServlet(new ServletContainer(resourceConfig.packages(classPackages)))
+                    .addListener(ContextLoaderListener.class)
                     .contextParam("contextConfigLocation", "classpath:test-config.xml")
                     .build();
 
@@ -82,10 +82,10 @@
         }
 
         testContainer = tcf.create(
-                UriBuilder.fromUri(containerURI).port(port).build(), ad);
-        client = testContainer.getClient();
+                UriBuilder.fromUri(containerURI).port(port).build(), dc);
+        client = testContainer.getClientConfig().getClient();
         if (client == null) {
-            client = Client.create(ad.getClientConfig());
+            client = ClientBuilder.newClient(testContainer.getClientConfig());
         }
     }
 
@@ -108,8 +108,8 @@
     }
 
 
-    public WebResource resource () {
-        return client.resource(getBaseUri());
+    public WebTarget target () {
+        return client.target(getBaseUri());
     }
     
 //    protected TestHelper helper () {
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 ae52237..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,10 +20,12 @@
 public class AnnotationControllerTest extends SpringJerseyTest {
     @Test
     public void testAnnotationLayers () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
-                .path("annotation").path("layers").get(ClientResponse.class);
+        Response response = target().path(API_VERSION)
+                .path("annotation").path("layers")
+                .request()
+                .get();
 
-        String entity = response.getEntity(String.class);
+        String entity = response.readEntity(String.class);
         JsonNode n = JsonUtils.readTree(entity);
 
         assertEquals(31, n.size());
@@ -37,13 +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\"}")
-                        .post(ClientResponse.class);
+        String json = "{\"codes\":[\"opennlp/*\"], \"language\":\"en\"}";
+        Response response =
+                target().path(API_VERSION).path("annotation")
+                        .path("description")
+                        .request()
+                        .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);
@@ -64,13 +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\"}")
-                        .post(ClientResponse.class);
+        String json = "{\"codes\":[\"mate/m\"], \"language\":\"en\"}";
+        Response response =
+                target().path(API_VERSION).path("annotation")
+                        .path("description")
+                        .request()
+                        .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 d5f4aeb..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,12 +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)
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path("auth")
+                .path("sessionToken")
+                .request()
+                .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);
 
@@ -51,19 +54,23 @@
         assertNotEquals("", token_type);
         assertFalse(TimeUtils.isExpired(ex.getMillis()));
 
-        response = resource().path("user")
-                .path("info").header(Attributes.AUTHORIZATION, token_type + " "+ token)
-                .get(ClientResponse.class);
-        en = response.getEntity(String.class);
+        response = target().path("user")
+                .path("info")
+                .request()
+                .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")
-                .path("logout").header(Attributes.AUTHORIZATION, token_type + " "+ token)
-                .get(ClientResponse.class);
+        response = target().path("auth")
+                .path("logout")
+                .request()
+                .header(Attributes.AUTHORIZATION, token_type + " "+ token)
+                .get();
         
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
     }
 
@@ -71,12 +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)
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path("auth")
+                .path("sessionToken")
+                .request()
+                .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);
 
@@ -91,15 +100,17 @@
             if (TimeUtils.isExpired(ex.getMillis()))
                 break;
         }
-        response = resource().path("user")
-                .path("info").header(Attributes.AUTHORIZATION, token_type + " "+ token)
-                .get(ClientResponse.class);
-        en = response.getEntity(String.class);
+        response = target().path("user")
+                .path("info")
+                .request()
+                .header(Attributes.AUTHORIZATION, token_type + " "+ token)
+                .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 6d3816f..e2605ab 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
@@ -8,9 +8,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.ProcessingException;
+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,77 +137,79 @@
 
 
 
-    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)
-                .get(ClientResponse.class);
+                .request()
+                .get();
     }
 
 
-    private ClientResponse searchQueryWithIP (String collectionQuery, String ip)
-            throws UniformInterfaceException, ClientHandlerException,
+    private Response searchQueryWithIP (String collectionQuery, String ip)
+            throws ProcessingException,
             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,
                         HttpAuthorizationHandler
                                 .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",
@@ -230,11 +232,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));
     }
 
 
@@ -242,186 +244,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());
@@ -429,33 +431,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 1d9ad73..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,10 +17,12 @@
     
     @Test
     public void testResource () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
-                .path("resource").get(ClientResponse.class);
+        Response response = target().path(API_VERSION)
+                .path("resource")
+                .request()
+                .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 ceaf422..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,12 +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)
-                .post(ClientResponse.class, m);
+        Response response = target().path(API_VERSION).path("index")
+                .path("close")
+                .request()
+                .post(Entity.form(form));
 
         assertEquals(HttpStatus.SC_OK, response.getStatus());
         assertEquals(false, searchKrill.getIndex().isReaderOpen());
@@ -72,17 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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 68b7f3b..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,12 +26,13 @@
 
     @Test
     public void testInfo () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("info")
-                .get(ClientResponse.class);
+        Response response = target().path(API_VERSION).path("info")
+                .request()
+                .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 6209b23..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,14 +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", "*")
-                .get(ClientResponse.class);
+                .request()
+                .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);
@@ -45,14 +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", "*")
-                .get(ClientResponse.class);
+                .request()
+                .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,
@@ -66,18 +69,19 @@
 
     @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()
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .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);
@@ -97,31 +101,33 @@
 
     @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,
                         HttpAuthorizationHandler
                                 .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,
                         HttpAuthorizationHandler
                                 .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 661cad1..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,13 +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").get(ClientResponse.class);
+                .queryParam("fields", "author")
+                .request()
+                .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());
@@ -36,13 +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").get(ClientResponse.class);
+                .queryParam("fields", "author,title")
+                .request()
+                .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());
@@ -52,13 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -70,13 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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,
@@ -89,31 +96,33 @@
 
     @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,
                         HttpAuthorizationHandler
                                 .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,
                         HttpAuthorizationHandler
                                 .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());
     }
 
@@ -122,16 +131,17 @@
     @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,
                         HttpAuthorizationHandler
                                 .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 1692fdc..911e716 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
@@ -6,9 +6,9 @@
 import org.junit.Test;
 
 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.ProcessingException;
+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,14 +19,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\"")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -42,15 +43,16 @@
 
     @Test
     public void testStatisticsWithMultipleCq ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics").queryParam("cq", "textType=Abhandlung")
                 .queryParam("cq", "corpusSigle=GOE")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -62,16 +64,17 @@
 
     @Test
     public void testStatisticsWithMultipleCorpusQuery ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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")
-                        .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                        .request()
+                        .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 2473d21..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,26 +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(),
@@ -75,30 +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);
@@ -107,13 +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());
@@ -123,13 +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,
@@ -141,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());
@@ -164,15 +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());
 
@@ -184,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);
@@ -204,19 +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);
@@ -235,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",
@@ -250,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 789c2d9..db29dec 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;
@@ -11,11 +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.UniformInterfaceException;
-import com.sun.jersey.api.client.ClientResponse.Status;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+import javax.ws.rs.ProcessingException;
+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,30 +43,31 @@
                 .createBasicAuthorizationHeaderValue("dory", "password");
     }
 
-    private ClientResponse updateClientPrivilege (String username,
-            MultivaluedMap<String, String> form)
-            throws UniformInterfaceException, ClientHandlerException,
+    private Response updateClientPrivilege (String username,
+            Form form)
+            throws ProcessingException,
             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;
     }
     
     private void updateClientPriviledge (String clientId, boolean isSuper)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -84,9 +85,11 @@
         int accessTokensBefore = accessDao.retrieveInvalidAccessTokens().size();
         assertTrue(accessTokensBefore > 0);
 
-        resource().path(API_VERSION).path("oauth2").path("admin").path("token")
-                .path("clean").header(Attributes.AUTHORIZATION, adminAuthHeader)
-                .get(ClientResponse.class);
+        target().path(API_VERSION).path("oauth2").path("admin").path("token")
+                .path("clean")
+                .request()
+                .header(Attributes.AUTHORIZATION, adminAuthHeader)
+                .get();
 
         assertEquals(0, refreshDao.retrieveInvalidRefreshTokens().size());
         assertEquals(0, accessDao.retrieveInvalidAccessTokens().size());
@@ -98,9 +101,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();
@@ -109,9 +112,11 @@
         int accessTokensAfter = accessDao.retrieveInvalidAccessTokens().size();
         assertEquals(accessTokensAfter, accessTokensBefore + 1);
 
-        resource().path(API_VERSION).path("oauth2").path("admin").path("token")
-                .path("clean").header(Attributes.AUTHORIZATION, adminAuthHeader)
-                .get(ClientResponse.class);
+        target().path(API_VERSION).path("oauth2").path("admin").path("token")
+                .path("clean")
+                .request()
+                .header(Attributes.AUTHORIZATION, adminAuthHeader)
+                .get();
 
         assertEquals(0, accessDao.retrieveInvalidAccessTokens().size());
     }
@@ -119,8 +124,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();
 
@@ -149,13 +154,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());
@@ -172,11 +178,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 7501798..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,26 +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(),
@@ -69,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 =
@@ -86,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 02b9ba1..a0655c6 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;
@@ -21,12 +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.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.ProcessingException;
+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 +52,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 +113,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();
@@ -130,13 +131,13 @@
     
     @Test
     public void testRegisterClientNameTooShort ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         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());
@@ -145,13 +146,13 @@
     }
 
     @Test
-    public void testRegisterClientEmptyName () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testRegisterClientEmptyName ()
+            throws ProcessingException, KustvaktException {
         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());
@@ -161,13 +162,13 @@
 
     @Test
     public void testRegisterClientMissingName ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         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());
@@ -177,13 +178,13 @@
 
     @Test
     public void testRegisterClientMissingDescription ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         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());
@@ -193,13 +194,13 @@
 
     @Test
     public void testRegisterClientMissingType ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         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());
@@ -209,7 +210,7 @@
     
     @Test
     public void testRegisterClientInvalidRedirectURI ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         // invalid hostname
         String redirectUri = "https://test.public.client/redirect";
@@ -217,50 +218,50 @@
                 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());
     }
     
     @Test
     public void testRegisterPublicClientWithRefreshTokenExpiry ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         OAuth2ClientJson clientJson =
                 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());
     }
     
     @Test
     public void testRegisterConfidentialClientWithRefreshTokenExpiry ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         int expiry = 31535000;
         OAuth2ClientJson clientJson =
                 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());
@@ -270,14 +271,14 @@
     
     @Test
     public void testRegisterConfidentialClientWithInvalidRefreshTokenExpiry ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         OAuth2ClientJson clientJson = createOAuth2ClientJson(
                 "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());
@@ -287,7 +288,7 @@
     
     @Test
     public void testRegisterClientInvalidURL ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         // invalid hostname
         String url = "https://test.public.client";
@@ -295,14 +296,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, 
@@ -316,8 +317,8 @@
     }
 
     @Test
-    public void testRegisterPublicClient () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testRegisterPublicClient ()
+            throws ProcessingException, KustvaktException {
         String redirectUri = "https://public.client.com/redirect";
         OAuth2ClientJson clientJson =
                 createOAuth2ClientJson("OAuth2PublicClient",
@@ -326,9 +327,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();
@@ -341,30 +342,31 @@
     }
 
     private void testRegisterClientUnauthorizedScope (String clientId)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
 
         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());
@@ -375,23 +377,24 @@
 
     @Test
     public void testRegisterClientUsingPlainJson ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException, IOException {
 
         InputStream is = getClass().getClassLoader()
                 .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,
                         HttpAuthorizationHandler
                                 .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();
@@ -403,15 +406,15 @@
     }
 
     @Test
-    public void testRegisterDesktopApp () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testRegisterDesktopApp ()
+            throws ProcessingException, KustvaktException {
         OAuth2ClientJson clientJson = createOAuth2ClientJson(
                 "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();
@@ -425,7 +428,7 @@
 
     @Test
     public void testRegisterMultipleDesktopApps ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
 
         // First client
@@ -433,9 +436,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();
@@ -448,7 +451,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();
@@ -470,9 +473,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);
@@ -484,13 +487,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",
@@ -498,63 +501,67 @@
     }
 
     private void testDeregisterPublicClientMissingUserAuthentication (
-            String clientId) throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+            String clientId) throws
+            ProcessingException, KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("oauth2")
+        Response response = target().path(API_VERSION).path("oauth2")
                 .path("client").path("deregister").path(clientId)
-                .delete(ClientResponse.class);
+                .request()
+                .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());
     }
 
     private void testDeregisterPublicClientMissingId ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
     }
 
     private void testDeregisterPublicClient (String clientId, String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
     }
 
     private void testResetPublicClientSecret (String clientId)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -563,21 +570,22 @@
     }
 
     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);
+            String clientSecret) throws
+            ProcessingException, KustvaktException {
+        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);
@@ -591,19 +599,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());
@@ -638,7 +647,7 @@
     }
     
     private void testListConfidentialClient (String username, String clientId)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         JsonNode node = listUserRegisteredClients(username);
         assertEquals(1, node.size());
@@ -666,7 +675,7 @@
                 .createBasicAuthorizationHeaderValue(username, password);
 
         // super client
-        ClientResponse response = requestTokenWithPassword(superClientId,
+        Response response = requestTokenWithPassword(superClientId,
                 clientSecret, username, password);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -676,7 +685,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
@@ -696,7 +705,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,
@@ -710,7 +719,7 @@
         // client 2
         String code =
                 requestAuthorizationCode(confidentialClientId, userAuthHeader);
-        ClientResponse response = requestTokenWithAuthorizationCodeAndForm(
+        Response response = requestTokenWithAuthorizationCodeAndForm(
                 confidentialClientId, clientSecret, code);
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
@@ -722,7 +731,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());
@@ -738,10 +747,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
@@ -749,7 +758,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();
 
@@ -768,25 +777,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 82caebe..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,20 +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());
@@ -523,20 +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());
@@ -548,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());
@@ -563,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);
@@ -579,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);
@@ -604,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,
@@ -623,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);
@@ -645,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());
@@ -658,17 +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);
@@ -680,41 +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);
@@ -739,64 +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);
     }
 
@@ -814,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
@@ -860,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
@@ -907,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
@@ -918,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 da625bd..b53b90d 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;
@@ -30,10 +30,9 @@
 import com.nimbusds.jwt.JWTClaimsSet;
 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.ProcessingException;
+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 +51,10 @@
             "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
                                 .createBasicAuthorizationHeaderValue(username,
@@ -62,37 +62,38 @@
                 .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
     public void testRequestAuthorizationCode ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -104,9 +105,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() + "://"
@@ -114,9 +115,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());
@@ -125,25 +126,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
@@ -152,8 +153,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",
@@ -164,17 +165,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",
@@ -182,13 +183,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();
@@ -210,17 +211,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");
     }
 
@@ -240,16 +241,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");
     }
 
@@ -259,33 +260,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());
@@ -300,9 +301,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",
@@ -310,9 +311,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 "
@@ -320,9 +321,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",
@@ -355,20 +356,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,
@@ -378,9 +379,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",
@@ -388,9 +389,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",
@@ -399,9 +400,11 @@
 
     @Test
     public void testPublicKeyAPI () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("oauth2").path("openid")
-                .path("jwks").get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+        Response response = target().path(API_VERSION).path("oauth2").path("openid")
+                .path("jwks")
+                .request()
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
         assertEquals(1, node.at("/keys").size());
         node = node.at("/keys/0");
@@ -413,9 +416,11 @@
 
     @Test
     public void testOpenIDConfiguration () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("oauth2").path("openid")
-                .path("config").get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+        Response response = target().path(API_VERSION).path("oauth2").path("openid")
+                .path("config")
+                .request()
+                .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 7e3b093..9d9a398 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;
@@ -15,11 +16,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.ProcessingException;
+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;
@@ -40,8 +40,8 @@
     private InstalledPluginDao pluginDao;
 
     @Test
-    public void testRegisterPlugin () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testRegisterPlugin () throws
+            ProcessingException, KustvaktException {
         JsonNode source = JsonUtils.readTree("{ \"plugin\" : \"source\"}");
 
         int refreshTokenExpiry = TimeUtils.convertTimeToSeconds("90D");
@@ -54,9 +54,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 +85,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());
@@ -100,8 +100,8 @@
     }
 
     private void testRetrievePluginInfo (String clientId,
-            int refreshTokenExpiry) throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+            int refreshTokenExpiry) throws
+            ProcessingException, KustvaktException {
         JsonNode clientInfo = retrieveClientInfo(clientId, username);
         assertEquals(clientId, clientInfo.at("/client_id").asText());
         assertEquals("Plugin", clientInfo.at("/client_name").asText());
@@ -119,7 +119,7 @@
 
     private void testListUserRegisteredPlugins (String username,
             String clientId, String clientName, int refreshTokenExpiry)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
 
         JsonNode node = listUserRegisteredClients(username);
@@ -137,38 +137,39 @@
 
     @Test
     public void testListPluginsUnauthorizedPublic ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
     }
 
     @Test
     public void testListPluginsUnauthorizedConfidential ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
     }
 
     @Test
     public void testListPluginsMissingClientSecret ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -178,17 +179,18 @@
     }
 
     private void testListPluginsClientUnauthorized (
-            MultivaluedMap<String, String> form)
-            throws UniformInterfaceException, ClientHandlerException,
+            Form form)
+            throws ProcessingException,
             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());
@@ -200,16 +202,18 @@
 
     @Test
     public void testListPluginsUserUnauthorized ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -218,8 +222,8 @@
     }
 
     @Test
-    public void testListAllPlugins () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testListAllPlugins () throws
+            ProcessingException, KustvaktException {
         JsonNode node = listPlugins(false);
         assertEquals(2, node.size());
         assertFalse(node.at("/0/client_id").isMissingNode());
@@ -235,34 +239,35 @@
     }
 
     private JsonNode listPlugins (boolean permitted_only)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
+            String clientId, String username) throws
+            ProcessingException, KustvaktException {
+        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());
@@ -278,13 +283,13 @@
     }
 
     @Test
-    public void testInstallPublicPlugin () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = getSuperClientForm();
-        form.add("client_id", publicClientId2);
-        ClientResponse response = installPlugin(form);
+    public void testInstallPublicPlugin () throws
+            ProcessingException, KustvaktException {
+        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());
@@ -307,11 +312,11 @@
     }
 
     private void testInstallPluginRedundant (
-            MultivaluedMap<String, String> form)
-            throws UniformInterfaceException, ClientHandlerException,
+            Form form)
+            throws ProcessingException,
             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());
@@ -319,12 +324,12 @@
     }
 
     private void testInstallPluginNotPermitted (String clientId)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -333,11 +338,11 @@
 
     @Test
     public void testInstallPluginMissingClientId ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -346,12 +351,12 @@
 
     @Test
     public void testInstallPluginInvalidClientId ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -361,13 +366,13 @@
 
     @Test
     public void testInstallPluginMissingSuperClientSecret ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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",
@@ -379,11 +384,11 @@
 
     @Test
     public void testInstallPluginMissingSuperClientId ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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",
@@ -395,44 +400,46 @@
 
     @Test
     public void testInstallPluginUnauthorizedClient ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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)
-            throws UniformInterfaceException, ClientHandlerException,
+    private Response installPlugin (Form form)
+            throws ProcessingException,
             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)
-            throws UniformInterfaceException, ClientHandlerException,
+    private Response uninstallPlugin (String clientId, String username)
+            throws ProcessingException,
             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,
@@ -449,7 +456,7 @@
 
     @Test
     public void testListUserInstalledPlugins ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException, IOException {
 
         testInstallConfidentialPlugin(superClientId, confidentialClientId,
@@ -466,7 +473,7 @@
         node = retrieveUserInstalledPlugin(getSuperClientForm());
         assertEquals(2, node.size());
 
-        ClientResponse response =
+        Response response =
                 uninstallPlugin(confidentialClientId, username);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
         node = retrieveUserInstalledPlugin(getSuperClientForm());
@@ -488,39 +495,40 @@
         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;
     }
 
     private void testUninstallNotInstalledPlugin ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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)
-            throws UniformInterfaceException, ClientHandlerException,
+            Form form)
+            throws ProcessingException,
             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 9b3d506..c12a921 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;
 
@@ -19,12 +21,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.ProcessingException;
+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 +73,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);
@@ -101,14 +103,14 @@
             request = request.queryParam("state", state);
         }
         
-        return request.header(Attributes.AUTHORIZATION, authHeader)
-                .get(ClientResponse.class);
+        return request.request().header(Attributes.AUTHORIZATION, authHeader)
+                .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 +123,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,129 +134,136 @@
         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")
-                .path("token").header(Attributes.AUTHORIZATION, authHeader)
+        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,
-            OAuth2ClientJson json) throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        return resource().path(API_VERSION).path("oauth2").path("client")
+    protected Response registerClient (String username,
+            OAuth2ClientJson json) throws
+            ProcessingException, KustvaktException {
+        return target().path(API_VERSION).path("oauth2").path("client")
                 .path("register")
+                .request()
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue(username,
                                         "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();
@@ -268,7 +277,7 @@
     }
 
     protected void testConfidentialClientInfo (String clientId, String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         JsonNode clientInfo = retrieveClientInfo(clientId, username);
         assertEquals(clientId, clientInfo.at("/client_id").asText());
@@ -290,46 +299,49 @@
     }
 
     protected void deregisterClient (String username,
-            String clientId) throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+            String clientId) throws
+            ProcessingException, 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());
     }
 
     protected JsonNode retrieveClientInfo (String clientId, String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
@@ -338,9 +350,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);
@@ -353,56 +365,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,
+            throws ProcessingException,
             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 5c20c5e..2e5ef40 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
@@ -7,10 +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.ProcessingException;
+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,12 +31,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());
         
@@ -52,17 +53,18 @@
     
     private void testUpdateQuery (String qName, String qCreator,
             String username, ResourceType type)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         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());
         
@@ -77,12 +79,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());
 
@@ -101,12 +104,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());
 
@@ -125,12 +129,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());
         
@@ -148,12 +153,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());
         
@@ -170,16 +176,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());
@@ -194,12 +201,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());
 
@@ -215,16 +223,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());
@@ -238,16 +247,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());
@@ -260,16 +270,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());
@@ -278,24 +289,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());
@@ -306,13 +319,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());
@@ -324,15 +338,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,
@@ -344,15 +359,15 @@
     }
 
     @Test
-    public void testListAvailableQueryForDory () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testListAvailableQueryForDory () throws
+            ProcessingException, KustvaktException {
         JsonNode node = testListAvailableQuery("dory");
         assertEquals(2, node.size());
     }
 
     @Test
     public void testListAvailableQueryForPearl ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
         
         JsonNode node = testListAvailableQuery("pearl");
@@ -368,18 +383,19 @@
     }
 
     private JsonNode testListAvailableQuery (String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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 198a1cb..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,14 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -51,13 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .request()
+                .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]]",
@@ -68,14 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .request()
+                .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]]",
@@ -86,18 +92,19 @@
     @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")
+                .request()
                 .header(Attributes.AUTHORIZATION,
                         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());
@@ -110,40 +117,42 @@
     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",
                         "creationDate since 1775 & corpusSigle=GOE")
                 .queryParam("name", "Weimarer Werke")
                 .queryParam("description", "Goethe-Werke in Weimar (seit 1775)")
+                .request()
                 .header(Attributes.AUTHORIZATION,
                         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()
                 .header(Attributes.AUTHORIZATION,
                         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);
 
@@ -158,19 +167,20 @@
         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")
                 .queryParam("context", "base/s:s")
+                .request()
                 .header(Attributes.AUTHORIZATION,
                         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);
@@ -198,14 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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",
@@ -225,17 +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")
-                .method("GET", ClientResponse.class);
+                .request()
+                .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());
@@ -253,17 +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")
-                .method("GET", ClientResponse.class);
+                .request()
+                .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 3e38c9a..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,11 +29,13 @@
 
     @Test
     public void testGetPublicVirtualCollectionInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("collection").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("collection")
+                .request()
+                .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());
@@ -41,17 +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());
@@ -60,11 +65,13 @@
 
     @Test
     public void testGetVirtualCollectionInfoById () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("collection").path("GOE-VC").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("collection").path("GOE-VC")
+                .request()
+                .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());
@@ -76,11 +83,13 @@
     @Test
     public void testGetVirtualCollectionInfoByIdUnauthorized ()
             throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("collection").path("WPD15-VC").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("collection").path("WPD15-VC")
+                .request()
+                .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());
@@ -92,11 +101,13 @@
 
     @Test
     public void testGetPublicCorporaInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("corpus")
+                .request()
+                .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());
@@ -106,12 +117,14 @@
 
     @Test
     public void testGetCorpusInfoById () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").path("WPD13").get(ClientResponse.class);
+        Response response = target().path(getAPIVersion())
+                .path("corpus").path("WPD13")
+                .request()
+                .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);
@@ -122,11 +135,13 @@
 
     @Test
     public void testGetCorpusInfoById2 () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").path("GOE").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("corpus").path("GOE")
+                .request()
+                .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());
@@ -136,11 +151,13 @@
 
     @Test
     public void testGetPublicFoundriesInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("foundry").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("foundry")
+                .request()
+                .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());
@@ -150,10 +167,12 @@
 
     @Test
     public void testGetFoundryInfoById () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("foundry").path("tt").get(ClientResponse.class);
-        String ent = response.getEntity(String.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("foundry").path("tt")
+                .request()
+                .get();
+        String ent = response.readEntity(String.class);
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(ent);
@@ -164,11 +183,13 @@
 
     @Test
     public void testGetUnexistingCorpusInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").path("ZUW19").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("corpus").path("ZUW19")
+                .request()
+                .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());
@@ -184,11 +205,13 @@
     // exception instead?
     @Test
     public void testGetUnauthorizedCorpusInfo () throws KustvaktException {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("corpus").path("BRZ10").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+        Response response = target().path(getAPIVersion())
+                .path("corpus").path("BRZ10")
+                .request()
+                .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 5b6cdb2..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,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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;
     }
@@ -58,16 +61,17 @@
 
     @Test
     public void testApiWelcomeMessage () {
-        ClientResponse response = resource().path(API_VERSION).path("")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(API_VERSION).path("")
+                .request()
+                .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());
     }
 
@@ -89,12 +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")
-                .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -108,15 +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").accept(MediaType.APPLICATION_JSON)
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .queryParam("count", "13")
+                .request()
+                .accept(MediaType.APPLICATION_JSON)
+                .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());
@@ -128,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -149,13 +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());
@@ -170,13 +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());
@@ -191,17 +201,18 @@
 
     @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,
                         HttpAuthorizationHandler
                                 .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);
@@ -222,17 +233,18 @@
 
     @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,
                         HttpAuthorizationHandler
                                 .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());
@@ -258,18 +270,19 @@
     @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()
                 .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);
         assertEquals("operation:insertion",
                 node.at("/collection/rewrites/0/operation").asText());
@@ -289,16 +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());
@@ -313,13 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .request()
+                .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());
@@ -327,12 +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").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .queryParam("context", "sentence")
+                .request()
+                .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());
@@ -346,11 +363,12 @@
         QuerySerializer s = new QuerySerializer();
         s.setQuery("(der) or (das)", "CQL");
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
-                .post(ClientResponse.class, s.toJSON());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(API_VERSION).path("search")
+                .request()
+                .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);
@@ -362,11 +380,12 @@
     @Test
     @Ignore
     public void testSearchRawQuery () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("search")
-                .post(ClientResponse.class, createJsonQuery());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(API_VERSION).path("search")
+                .request()
+                .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);
@@ -380,16 +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);
@@ -403,16 +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 27e6695..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,14 +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").get(ClientResponse.class);
+                .queryParam("engine", "network")
+                .request()
+                .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());
@@ -93,15 +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").get(ClientResponse.class);
+                .queryParam("engine", "network")
+                .request()
+                .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());
     }
     
@@ -109,15 +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").get(ClientResponse.class);
+                .queryParam("engine", "network")
+                .request()
+                .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 2d95b19..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,14 +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).get(ClientResponse.class);
+                .queryParam("pipes", glemmUri)
+                .request()
+                .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());
@@ -157,11 +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).get(ClientResponse.class);
+                .queryParam("pipes", glemmUri)
+                .request()
+                .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());
     }
@@ -181,15 +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)
-                .get(ClientResponse.class);
+                .request()
+                .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());
     }
@@ -198,14 +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).get(ClientResponse.class);
+                .queryParam("pipes", url)
+                .request()
+                .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,14 +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").get(ClientResponse.class);
+                .queryParam("pipes", "http://glemm")
+                .request()
+                .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());
@@ -236,12 +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).get(ClientResponse.class);
+                .queryParam("pipes", pipeUri)
+                .request()
+                .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);
@@ -253,16 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -289,12 +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).get(ClientResponse.class);
+                .queryParam("pipes", pipeUri)
+                .request()
+                .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);
@@ -313,12 +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).get(ClientResponse.class);
+                .queryParam("pipes", pipeUri)
+                .request()
+                .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);
@@ -341,28 +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)
-                .get(ClientResponse.class);
+                .request()
+                .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")
-                .get(ClientResponse.class);
+                .request()
+                .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 3050ff6..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,13 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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)",
@@ -38,14 +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)",
@@ -56,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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)",
@@ -79,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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,
@@ -110,11 +117,12 @@
         meta.addEntry("snippets", "true");
         s.setMeta(meta);
         
-        ClientResponse response = resource().path(API_VERSION).path("search")
-                .post(ClientResponse.class, s.toJSON());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(API_VERSION).path("search")
+                .request()
+                .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)",
@@ -126,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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",
@@ -160,13 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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 c04f8a2..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,15 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -38,15 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -56,16 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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 9d9e2c3..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,9 +54,10 @@
 	@Test
 	public void loginHTTP() throws KustvaktException {
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("user").path("info")
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		Response response = target().path("user").path("info")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 	}
 
 	// EM: This test require VPN / IDS Intranet
@@ -63,22 +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")
-				.header(Attributes.AUTHORIZATION, en).get(ClientResponse.class);
+		Response response = target().path("auth").path("apiToken")
+				.request()
+				.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());
@@ -92,12 +96,13 @@
 		assertTrue(BeansFactory.getKustvaktContext().getConfiguration().getTokenTTL() < 10);
 
 		String en = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("auth").path("apiToken")
-				.header(Attributes.AUTHORIZATION, en).get(ClientResponse.class);
+		Response response = target().path("auth").path("apiToken")
+				.request()
+				.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();
 
@@ -111,18 +116,20 @@
 				break;
 		}
 
-		response = resource().path("user").path("info")
-				.header(Attributes.AUTHORIZATION, "api_token " + token).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
+		response = target().path("user").path("info")
+				.request()
+				.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")
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		Response response = target().path("user").path("details")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 	}
 
 	@Test
@@ -131,15 +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")
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.getEntity(String.class);
+		response = target().path("user").path("details").queryParam("pointer", "test")
+				.request()
+				.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);
 	}
 
@@ -149,15 +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").header(Attributes.AUTHORIZATION, enc)
-				.get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.getEntity(String.class);
+		response = target().path("user").path("details")
+				.request()
+				.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());
@@ -168,10 +180,12 @@
 	@Test
 	public void testGetUserDetailsPointer() throws KustvaktException {
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("user").path("details")
-				.queryParam("pointer", "email").header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
-		String ent = response.getEntity(String.class);
+		Response response = target().path("user").path("details")
+				.queryParam("pointer", "email")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
+		String ent = response.readEntity(String.class);
 		assertEquals("test@ids-mannheim.de", ent);
 	}
 
@@ -180,10 +194,11 @@
 //		helper().setupSimpleAccount("userservicetest", "servicepass");
 
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue("userservicetest", "servicepass");
-		ClientResponse response = resource().path("user").path("details")
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
-		String entity = response.getEntity(String.class);
+		Response response = target().path("user").path("details")
+				.request()
+				.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());
@@ -193,9 +208,10 @@
 	@Test
 	public void testGetUserSettings() throws KustvaktException {
 		String enc = HttpAuthorizationHandler.createBasicAuthorizationHeaderValue(credentials[0], credentials[1]);
-		ClientResponse response = resource().path("user").path("settings")
-				.header(Attributes.AUTHORIZATION, enc).get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		Response response = target().path("user").path("settings")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc).get();
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 	}
 
 	@Test
@@ -206,16 +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").header(Attributes.AUTHORIZATION, enc)
-				.get(ClientResponse.class);
+		response = target().path("user").path("details")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc)
+				.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());
@@ -227,47 +246,56 @@
 		m.put("lastName", "user");
 		m.put("email", "test@ids-mannheim.de");
 
-		response = resource().path("user").path("details").header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", MediaType.APPLICATION_JSON).post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		response = target().path("user").path("details")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc)
+				.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").header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", "application/x-www-form-urlencodeBase64d").post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		response = target().path("user").path("settings")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc)
+				.header("Content-Type", "application/x-www-form-urlencodeBase64d")
+				.post(Entity.form(m));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("settings").header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", "application/x-www-form-urlencodeBase64d").get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		response = target().path("user").path("settings")
+				.request()
+				.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);
 	}
 
@@ -279,29 +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").header(Attributes.AUTHORIZATION, enc)
-				.header("Content-Type", MediaType.APPLICATION_JSON).post(ClientResponse.class, m);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		response = target().path("user").path("settings")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc)
+				.header("Content-Type", MediaType.APPLICATION_JSON)
+				.post(Entity.json(m));
+		assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
-		response = resource().path("user").path("settings").header(Attributes.AUTHORIZATION, enc)
-				.get(ClientResponse.class);
-		assertEquals(ClientResponse.Status.OK.getStatusCode(), response.getStatus());
+		response = target().path("user").path("settings")
+				.request()
+				.header(Attributes.AUTHORIZATION, enc)
+				.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 3ca0e68..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,19 +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)
-                .get(ClientResponse.class);
+                .request()
+                .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);
@@ -48,13 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -66,14 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -87,14 +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)
-                .get(ClientResponse.class);
+                .request()
+                .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);
@@ -109,13 +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")
-                .get(ClientResponse.class);
-        String ent = response.getEntity(String.class);
+                .request()
+                .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);
@@ -126,14 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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(),
@@ -146,13 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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);
@@ -166,13 +175,14 @@
     @Test
     public void testGetStatisticsWithoutcorpusQuery ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
                 .path("statistics")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -184,22 +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());
@@ -211,14 +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);
@@ -229,14 +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());
@@ -247,11 +260,13 @@
     @Test
     public void testGetStatisticsWithoutKoralQuery ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
-                .path("statistics").post(ClientResponse.class);
+        Response response = target().path(API_VERSION)
+                .path("statistics")
+                .request()
+                .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 b51d912..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,19 +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();
 
@@ -64,14 +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);
@@ -83,24 +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 5201884..07db0a2 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,16 @@
 
 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.ProcessingException;
+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;
@@ -33,32 +31,34 @@
     private String testUser = "UserGroupControllerAdminTest";
 
     private JsonNode listGroup (String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -66,16 +66,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());
@@ -83,31 +84,33 @@
 
     // same as list user-groups of the admin
     @Test
-    public void testListWithoutUsername () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+    public void testListWithoutUsername () throws
+            ProcessingException, KustvaktException {
+        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")
+    public void testListByStatusAll () throws
+            ProcessingException, KustvaktException {
+        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;
@@ -120,38 +123,39 @@
     }
 
     @Test
-    public void testListByStatusHidden () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+    public void testListByStatusHidden () throws
+            ProcessingException, KustvaktException {
+        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());
     }
 
     @Test
-    public void testUserGroup () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testUserGroup () throws
+            ProcessingException, KustvaktException {
 
         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());
 
@@ -168,18 +172,19 @@
     }
 
     private void testMemberRole (String memberUsername, String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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")
                 .header(Attributes.AUTHORIZATION,
                         HttpAuthorizationHandler
                                 .createBasicAuthorizationHeaderValue(
                                         memberUsername, "pass"))
-                .post(ClientResponse.class);
+                .post(Entity.form(new Form()));
 
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
@@ -188,22 +193,22 @@
     }
 
     private void testAddMemberRoles (String groupName, String memberUsername)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -221,21 +226,21 @@
     }
 
     private void testDeleteMemberRoles (String groupName, String memberUsername)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -251,32 +256,34 @@
     }
 
     private JsonNode retrieveGroup (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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;
     }
 
     private void testDeleteGroup (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -286,15 +293,16 @@
     }
 
     private void testDeleteMember (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -308,18 +316,18 @@
     }
 
     private void testInviteMember (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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 8bc2a5e..f30baa9 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,19 +4,17 @@
 
 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;
 
 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.ProcessingException;
+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;
@@ -43,14 +41,15 @@
     private String admin = "admin";
 
     private JsonNode retrieveUserGroups (String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -58,12 +57,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());
     }
@@ -71,12 +71,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());
 
@@ -91,12 +92,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);
@@ -111,12 +113,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());
@@ -124,10 +127,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());
@@ -139,10 +143,10 @@
 
     
     @Test
-    public void testCreateGroupEmptyDescription () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testCreateGroupEmptyDescription () throws
+            ProcessingException, KustvaktException {
         String groupName = "empty_group";
-        ClientResponse response = testCreateUserGroup(groupName,"");
+        Response response = testCreateUserGroup(groupName,"");
         assertEquals(Status.CREATED.getStatusCode(), response.getStatus());
         
         deleteGroupByName(groupName);
@@ -150,53 +154,55 @@
 
     
     @Test
-    public void testCreateGroupMissingDescription () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testCreateGroupMissingDescription () throws
+            ProcessingException, 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)
-            throws UniformInterfaceException, ClientHandlerException,
+    private Response testCreateUserGroup (String groupName, String description)
+            throws ProcessingException,
             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)
-                .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 ProcessingException,
+            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;
     }
     
     @Test
-    public void testCreateGroupInvalidName () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testCreateGroupInvalidName () throws
+            ProcessingException, 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());
@@ -204,14 +210,14 @@
     }
     
     @Test
-    public void testCreateGroupNameTooShort () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testCreateGroupNameTooShort () throws
+            ProcessingException, 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());
@@ -219,13 +225,13 @@
     }
     
     @Test
-    public void testUserGroup () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testUserGroup () throws
+            ProcessingException, KustvaktException {
 
         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
@@ -261,10 +267,10 @@
     }
 
     private void testUpdateUserGroup (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
@@ -273,40 +279,43 @@
     }
 
     private void testDeleteMember (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
     }
 
     private void testDeleteMemberUnauthorized (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -317,15 +326,16 @@
     }
 
     // EM: same as cancel invitation
-    private void testDeletePendingMember () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    private void testDeletePendingMember () throws
+            ProcessingException, 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());
 
@@ -335,16 +345,17 @@
     }
 
     @Test
-    public void testDeleteDeletedMember () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+    public void testDeleteDeletedMember () throws
+            ProcessingException, KustvaktException {
+        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());
@@ -356,31 +367,33 @@
     }
 
     private void testDeleteGroup (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
@@ -393,17 +406,18 @@
     }
 
     @Test
-    public void testDeleteGroupUnauthorized () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testDeleteGroupUnauthorized () throws
+            ProcessingException, 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());
@@ -414,18 +428,19 @@
     }
 
     @Test
-    public void testDeleteDeletedGroup () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("group")
+    public void testDeleteDeletedGroup () throws
+            ProcessingException, KustvaktException {
+        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.",
@@ -434,18 +449,19 @@
     }
 
     @Test
-    public void testDeleteGroupOwner () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testDeleteGroupOwner () throws
+            ProcessingException, 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());
@@ -455,29 +471,30 @@
     }
 
     private void testInviteMember (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
@@ -489,18 +506,18 @@
         assertEquals(0, node.at("/members/1/roles").size());
     }
 
-    private void testInviteDeletedMember () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("members", "marlin");
+    private void testInviteDeletedMember () throws
+            ProcessingException, KustvaktException {
+        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());
 
@@ -514,19 +531,19 @@
     }
 
     @Test
-    public void testInviteDeletedMember2 () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testInviteDeletedMember2 () throws
+            ProcessingException, 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());
 
@@ -541,20 +558,20 @@
     }
 
     @Test
-    public void testInvitePendingMember () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testInvitePendingMember () throws
+            ProcessingException, 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());
@@ -569,23 +586,23 @@
     }
 
     @Test
-    public void testInviteActiveMember () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testInviteActiveMember () throws
+            ProcessingException, 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());
@@ -599,22 +616,22 @@
 
     @Test
     public void testInviteMemberToDeletedGroup ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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.",
@@ -625,12 +642,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());
 
@@ -664,13 +682,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());
@@ -682,25 +701,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);
 
@@ -713,13 +734,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());
@@ -730,18 +752,19 @@
     }
 
     private void testSubscribeToDeletedGroup (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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.",
@@ -749,14 +772,15 @@
     }
 
     private void testUnsubscribeActiveMember (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -766,13 +790,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());
 
@@ -789,17 +814,18 @@
 
     @Test
     public void testUnsubscribeDeletedMember ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -812,18 +838,19 @@
 
     @Test
     public void testUnsubscribePendingMember ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
 
         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());
 
@@ -837,28 +864,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,
@@ -869,16 +898,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,
@@ -888,19 +918,20 @@
     }
 
     private void testUnsubscribeToDeletedGroup (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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.",
@@ -908,18 +939,18 @@
     }
 
     @Test
-    public void testAddSameMemberRole () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("memberUsername", "dory");
-        form.add("roleId", "1");
+    public void testAddSameMemberRole () throws
+            ProcessingException, KustvaktException {
+        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());
 
@@ -929,18 +960,18 @@
     }
 
     @Test
-    public void testDeleteAddMemberRole () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("memberUsername", "dory");
-        form.add("roleId", "1");
+    public void testDeleteAddMemberRole () throws
+            ProcessingException, KustvaktException {
+        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());
 
@@ -952,17 +983,17 @@
     }
 
     @Test
-    public void testEditMemberRoleEmpty () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        MultivaluedMap<String, String> form = new MultivaluedMapImpl();
-        form.add("memberUsername", "dory");
+    public void testEditMemberRoleEmpty () throws
+            ProcessingException, KustvaktException {
+        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());
 
@@ -974,19 +1005,19 @@
     }
 
     private void testEditMemberRole ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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 ba26d0c..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,14 +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;
     }
@@ -49,12 +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());
 
@@ -77,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,
@@ -92,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());
@@ -107,15 +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());
@@ -123,14 +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());
@@ -139,15 +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,
@@ -161,48 +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());
@@ -214,11 +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());
     }
@@ -226,11 +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,
@@ -243,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);
@@ -252,14 +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 aa69a06..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,13 +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\"")
-                .get(ClientResponse.class);
+                .request()
+                .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);
@@ -96,13 +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\"")
-                .get(ClientResponse.class);
+                .request()
+                .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);
@@ -110,34 +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\"")
-                .get(ClientResponse.class);
+                .request()
+                .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")
-                .get(ClientResponse.class);
+                .request()
+                .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)
-                .get(ClientResponse.class);
+                .request()
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(2, node.at("/documents").asInt());
         
@@ -147,12 +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\"")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -161,12 +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\"")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -175,12 +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\"")
-                .get(ClientResponse.class);
+                .request()
+                .get();
 
-        String ent = response.getEntity(String.class);
+        String ent = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(ent);
         assertTrue(node.at("/matches").size() > 0);
         
@@ -200,28 +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 d4930c6..24caf0b 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,17 +2,17 @@
 
 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;
 
 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.ProcessingException;
+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;
@@ -30,18 +30,19 @@
     private String username = "VirtualCorpusControllerAdminTest";
 
     @Test
-    public void testSearchPrivateVC () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+    public void testSearchPrivateVC () throws
+            ProcessingException, KustvaktException {
+        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());
@@ -49,16 +50,17 @@
     }
 
     @Test
-    public void testSearchProjectVC () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testSearchProjectVC () throws
+            ProcessingException, 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());
 
@@ -69,35 +71,37 @@
     }
 
     @Test
-    public void testListDoryVC () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+    public void testListDoryVC () throws
+            ProcessingException, KustvaktException {
+        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")
+    private JsonNode testListSystemVC () throws
+            ProcessingException, KustvaktException {
+        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);
     }
 
@@ -107,12 +111,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());
 
@@ -123,14 +128,15 @@
     }
 
     private void testDeleteSystemVC (String vcCreator, String vcName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -139,20 +145,21 @@
     }
 
     @Test
-    public void testPrivateVC () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testPrivateVC () throws
+            ProcessingException, KustvaktException {
         String json = "{\"type\": \"PRIVATE\""
                 + ",\"queryType\": \"VIRTUAL_CORPUS\""
                 + ",\"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());
 
@@ -164,35 +171,37 @@
     }
 
     private JsonNode testListUserVC (String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
     }
 
     private void testEditPrivateVC (String vcCreator, String vcName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
 
         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());
 
@@ -201,14 +210,15 @@
     }
 
     private void testDeletePrivateVC (String vcCreator, String vcName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -218,15 +228,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);
@@ -242,22 +253,23 @@
 
     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);
     }
 
     @Test
-    public void testVCSharing () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testVCSharing () throws
+            ProcessingException, KustvaktException {
         String vcCreator = "marlin";
         String vcName = "marlin-vc";
         String groupName = "marlin-group";
@@ -272,32 +284,33 @@
     }
 
     private void testCreateVCAccess (String vcCreator, String vcName,
-            String groupName) throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response;
+            String groupName) throws
+            ProcessingException, KustvaktException {
+        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());
 
     }
 
     private void testDeleteVCAccess (String accessId)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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 fa39d4d..dc92a5d 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
@@ -17,11 +17,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.ProcessingException;
+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 +40,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));
@@ -56,64 +57,68 @@
     }
 
     private JsonNode testListVC (String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
     }
 
     private JsonNode testListOwnerVC (String username)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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;
     }
 
     @Test
-    public void testRetrieveSystemVCInfo () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testRetrieveSystemVCInfo () throws
+            ProcessingException, KustvaktException {
 
         JsonNode node = testSearchVC(testUser, "system", "system-vc");
         assertEquals("system-vc", node.at("/name").asText());
@@ -125,12 +130,14 @@
     }
 
     @Test
-    public void testRetrieveSystemVCGuest () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testRetrieveSystemVCGuest () throws
+            ProcessingException, KustvaktException {
 
-        ClientResponse response = resource().path(API_VERSION).path("vc")
-                .path("~system").path("system-vc").get(ClientResponse.class);
-        JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+        Response response = target().path(API_VERSION).path("vc")
+                .path("~system").path("system-vc")
+                .request()
+                .get();
+        JsonNode node = JsonUtils.readTree(response.readEntity(String.class));
         assertEquals("system-vc", node.at("/name").asText());
         assertEquals(ResourceType.SYSTEM.displayName(),
                 node.at("/type").asText());
@@ -142,7 +149,7 @@
 
     @Test
     public void testRetrieveOwnerPrivateVCInfo ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             KustvaktException {
 
         JsonNode node = testSearchVC("dory", "dory", "dory-vc");
@@ -153,15 +160,16 @@
 
     @Test
     public void testRetrievePrivateVCInfoUnauthorized ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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,
@@ -173,8 +181,8 @@
     }
 
     @Test
-    public void testRetrieveProjectVCInfo () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testRetrieveProjectVCInfo () throws
+            ProcessingException, KustvaktException {
 
         JsonNode node = testSearchVC("nemo", "dory", "group-vc");
         assertEquals("group-vc", node.at("/name").asText());
@@ -184,16 +192,17 @@
 
     @Test
     public void testRetrieveProjectVCInfoByNonActiveMember ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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,
@@ -205,8 +214,8 @@
     }
 
     @Test
-    public void testRetrievePublishedVCInfo () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testRetrievePublishedVCInfo () throws
+            ProcessingException, KustvaktException {
 
         JsonNode node = testSearchVC("gill", "marlin", "published-vc");
         assertEquals("published-vc", node.at("/name").asText());
@@ -214,16 +223,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();
@@ -231,39 +241,40 @@
     }
 
     @Test
-    public void testListAvailableVCNemo () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testListAvailableVCNemo () throws
+            ProcessingException, KustvaktException {
         JsonNode node = testListVC("nemo");
         assertEquals(3, node.size());
 
     }
 
     @Test
-    public void testListAvailableVCPearl () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testListAvailableVCPearl () throws
+            ProcessingException, KustvaktException {
         JsonNode node = testListVC("pearl");
         assertEquals(2, node.size());
 
     }
 
     @Test
-    public void testListAvailableVCDory () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testListAvailableVCDory () throws
+            ProcessingException, KustvaktException {
         JsonNode node = testListVC("dory");
         assertEquals(4, node.size());
     }
 
     @Test
     public void testListAvailableVCByOtherUser ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -276,11 +287,12 @@
     }
 
     @Test
-    public void testListAvailableVCByGuest () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
-                .get(ClientResponse.class);
-        String entity = response.getEntity(String.class);
+    public void testListAvailableVCByGuest () throws
+            ProcessingException, KustvaktException {
+        Response response = target().path(API_VERSION).path("vc")
+                .request()
+                .get();
+        String entity = response.readEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -293,12 +305,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(),
@@ -313,13 +326,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());
 
@@ -344,13 +358,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());
 
@@ -385,16 +400,17 @@
     }
 
     private JsonNode testCheckHiddenGroup (String groupName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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);
     }
 
@@ -413,15 +429,16 @@
             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,
                         AuthenticationScheme.API.displayName() + " "
                                 + 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());
 
@@ -445,16 +462,17 @@
                 + "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,
                         AuthenticationScheme.API.displayName() + " "
                                 + 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);
@@ -472,12 +490,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());
         
@@ -491,16 +510,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());
@@ -516,13 +536,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);
@@ -537,13 +558,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);
@@ -558,14 +580,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());
@@ -581,13 +604,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());
 
@@ -600,13 +624,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);
@@ -622,13 +647,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());
 
@@ -645,14 +671,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);
@@ -665,15 +692,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());
@@ -691,13 +719,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());
 
@@ -708,13 +737,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());
 
@@ -724,8 +754,8 @@
     }
 
     @Test
-    public void testEditCorpusQuery () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testEditCorpusQuery () throws
+            ProcessingException, KustvaktException {
         JsonNode node = testRetrieveKoralQuery("dory", "dory-vc");
         assertEquals("koral:docGroup", node.at("/collection/@type").asText());
         assertEquals("operation:and", node.at("/collection/operation").asText());
@@ -733,12 +763,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());
 
@@ -749,17 +780,18 @@
     }
     
     private JsonNode testRetrieveKoralQuery (String username, String vcName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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;
     }
@@ -768,14 +800,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());
@@ -799,13 +832,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
@@ -825,13 +859,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());
 
@@ -856,16 +891,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")
-    // .header(Attributes.AUTHORIZATION,
+    // .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());
@@ -876,13 +911,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());
@@ -894,8 +930,8 @@
     }
 
     @Test
-    public void testCreateDeleteAccess () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testCreateDeleteAccess () throws
+            ProcessingException, KustvaktException {
 
         String vcName = "marlin-vc";
         String groupName = "marlin-group";
@@ -905,7 +941,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());
 
@@ -939,24 +975,25 @@
         testEditVCType("marlin", "marlin", vcName, ResourceType.PRIVATE);
     }
 
-    private ClientResponse testShareVCByCreator (String vcCreator,
-            String vcName, String groupName) throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    private Response testShareVCByCreator (String vcCreator,
+            String vcName, String groupName) throws
+            ProcessingException, 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 =
+            String groupName) throws
+            ProcessingException, KustvaktException {
+        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());
@@ -968,41 +1005,42 @@
     }
 
     @Test
-    public void testShareUnknownVC () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = testShareVCByCreator("marlin",
+    public void testShareUnknownVC () throws
+            ProcessingException, KustvaktException {
+        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());
     }
 
     @Test
-    public void testShareUnknownGroup () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = testShareVCByCreator("marlin", "marlin-vc",
+    public void testShareUnknownGroup () throws
+            ProcessingException, KustvaktException {
+        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());
     }
 
     @Test
-    public void testShareVCByVCAAdmin () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testShareVCByVCAAdmin () throws
+            ProcessingException, 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,
@@ -1012,18 +1050,19 @@
     }
 
     @Test
-    public void testShareVCByNonVCAAdmin () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    public void testShareVCByNonVCAAdmin () throws
+            ProcessingException, 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,
@@ -1032,30 +1071,32 @@
                 node.at("/errors/0/1").asText());
     }
 
-    private ClientResponse testDeleteAccess (String username, String accessId)
-            throws UniformInterfaceException, ClientHandlerException,
+    private Response testDeleteAccess (String username, String accessId)
+            throws ProcessingException,
             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;
     }
 
     private void testDeleteAccessUnauthorized (String accessId)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
@@ -1066,12 +1107,12 @@
     }
 
     @Test
-    public void testDeleteNonExistingAccess () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = testDeleteAccess("dory", "100");
+    public void testDeleteNonExistingAccess () throws
+            ProcessingException, KustvaktException {
+        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 81f63a3..fb44266 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
@@ -10,10 +10,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.ProcessingException;
+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;
@@ -34,35 +33,37 @@
     private QueryDao dao;
 
     private JsonNode testRetrieveField (String username, String vcName,
-            String field) throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+            String field) throws
+            ProcessingException, KustvaktException {
+        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;
     }
 
     private void testRetrieveProhibitedField (String username, String vcName,
-            String field) throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("vc")
+            String field) throws
+            ProcessingException, KustvaktException {
+        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());
     }
@@ -101,8 +102,8 @@
         deleteVcFromDB("named-vc1");
     }
 
-    private void testRetrieveUnknownTokens () throws UniformInterfaceException,
-            ClientHandlerException, KustvaktException {
+    private void testRetrieveUnknownTokens () throws
+            ProcessingException, KustvaktException {
         JsonNode n = testRetrieveField("system", "named-vc1", "unknown");
         assertEquals("unknown", n.at("/corpus/key").asText());
         assertEquals(0, n.at("/corpus/value").size());
@@ -137,16 +138,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 f100941..c712030 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
@@ -6,10 +6,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.ProcessingException;
+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;
@@ -21,15 +21,16 @@
 public abstract class VirtualCorpusTestBase extends SpringJerseyTest{
     
     protected JsonNode testSearchVC (String username, String vcCreator, String vcName)
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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());
 
@@ -41,13 +42,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/pom.xml b/lite/pom.xml
index 14f2f67..3f64236 100644
--- a/lite/pom.xml
+++ b/lite/pom.xml
@@ -5,10 +5,10 @@
 	<artifactId>Kustvakt-lite</artifactId>
 	<version>0.68</version>
 	<properties>
-		<java.version>1.8</java.version>
+		<java.version>11</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<spring-framework.version>5.1.1.RELEASE</spring-framework.version>
-		<jersey.version>1.19.4</jersey.version>
+		<jersey.version>2.37</jersey.version>
 	</properties>
 
 	<build>
@@ -161,14 +161,14 @@
       	</dependency>
 		<!-- Jersey test framework -->
 		<dependency>
-			<groupId>com.sun.jersey.jersey-test-framework</groupId>
+			<groupId>org.glassfish.jersey.test-framework</groupId>
 			<artifactId>jersey-test-framework-core</artifactId>
 			<version>${jersey.version}</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>com.sun.jersey.jersey-test-framework</groupId>
-			<artifactId>jersey-test-framework-grizzly</artifactId>
+			<groupId>org.glassfish.jersey.test-framework.providers</groupId>
+			<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
 			<version>${jersey.version}</version>
 			<scope>test</scope>
 		</dependency>
diff --git a/lite/src/test/java/de/ids_mannheim/korap/config/LiteJerseyTest.java b/lite/src/test/java/de/ids_mannheim/korap/config/LiteJerseyTest.java
index e6536f5..882efce 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/config/LiteJerseyTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/config/LiteJerseyTest.java
@@ -1,9 +1,5 @@
 package de.ids_mannheim.korap.config;
 
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.util.concurrent.ThreadLocalRandom;
-
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.support.GenericApplicationContext;
@@ -11,13 +7,14 @@
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import org.springframework.web.context.support.GenericWebApplicationContext;
 
-import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import com.sun.jersey.test.framework.spi.container.TestContainerException;
-import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletContainer;
+import org.glassfish.jersey.test.DeploymentContext;
+import org.glassfish.jersey.test.JerseyTest;
+import org.glassfish.jersey.test.ServletDeploymentContext;
+import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory;
+import org.glassfish.jersey.test.spi.TestContainerException;
+import org.glassfish.jersey.test.spi.TestContainerFactory;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration("classpath:test-config.xml")
@@ -53,26 +50,11 @@
     }
     
     @Override
-    protected AppDescriptor configure () {
-        return new WebAppDescriptor.Builder(classPackages)
-                .servletClass(SpringServlet.class)
-                .contextListenerClass(StaticContextLoaderListener.class)
+    protected DeploymentContext configureDeployment() {
+        return ServletDeploymentContext
+                .forServlet(new ServletContainer(new ResourceConfig().packages(classPackages)))
+                .addListener(StaticContextLoaderListener.class)
                 .contextParam("adminToken", "secret")
                 .build();
     }
-
-    @Override
-    protected int getPort (int defaultPort) {
-        int port = ThreadLocalRandom.current().nextInt(5000, 8000 + 1);
-        try {
-            ServerSocket socket = new ServerSocket(port);
-            socket.close();
-        }
-        catch (IOException e) {
-            e.printStackTrace();
-            port = getPort(port);
-        }
-        return port;
-    }
-    
 }
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 95df495..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,12 +27,13 @@
     
     @Test
     public void testInfo () throws KustvaktException {
-        ClientResponse response = resource().path(API_VERSION).path("info")
-                .get(ClientResponse.class);
+        Response response = target().path(API_VERSION).path("info")
+                .request()
+                .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 ea7f964..08ae5ad 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
@@ -6,9 +6,10 @@
 import org.junit.Test;
 
 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.ProcessingException;
+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;
@@ -19,14 +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\"")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -42,15 +44,16 @@
 
     @Test
     public void testStatisticsWithMultipleCq ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -62,15 +65,16 @@
 
     @Test
     public void testStatisticsWithMultipleCorpusQuery ()
-            throws UniformInterfaceException, ClientHandlerException,
+            throws ProcessingException,
             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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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 ebbdbfe..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,13 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -63,34 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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")
-                .post(ClientResponse.class, query);
+        response = target().path(API_VERSION).path("search")
+                .request()
+                .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("")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(API_VERSION).path("")
+                .request()
+                .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")
@@ -100,13 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -117,13 +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").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .queryParam("count", "13")
+                .request()
+                .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);
@@ -136,13 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -156,11 +165,12 @@
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[orth=das]", "poliqarp");
 
-        ClientResponse response = resource().path(API_VERSION).path("search")
-                .post(ClientResponse.class, s.toJSON());
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response = target().path(API_VERSION).path("search")
+                .request()
+                .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());
@@ -169,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -187,13 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -204,13 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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(
@@ -224,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -245,13 +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").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .queryParam("hls", "true")
+                .request()
+                .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());
@@ -272,13 +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", "*").get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .queryParam("foundry", "*")
+                .request()
+                .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());
@@ -289,15 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -305,19 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -328,12 +348,13 @@
 
     @Test
     public void testMetaFields () throws KustvaktException {
-        ClientResponse response =
-                resource().path(API_VERSION).path("/corpus/GOE/AGA/01784")
-                        .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+        Response response =
+                target().path(API_VERSION).path("/corpus/GOE/AGA/01784")
+                        .request()
+                        .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());
 
@@ -383,9 +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")
-                .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+                .request()
+                .accept(MediaType.APPLICATION_JSON).get();
         assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
         URI location = response.getLocation();
         assertEquals("/api/v1.0/search", location.getPath());
@@ -393,10 +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)
-                .get(ClientResponse.class);
+                .queryParam("ql", "poliqarp")
+                .request()
+                .accept(MediaType.APPLICATION_JSON)
+                .get();
         assertEquals(HttpStatus.PERMANENT_REDIRECT_308, response.getStatus());
         URI location = response.getLocation();
         assertEquals("/api/v1.0/search", location.getPath());
@@ -404,43 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -448,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -468,14 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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,
@@ -488,13 +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")
-                .get(ClientResponse.class);
-        assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+                .request()
+                .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());
@@ -505,12 +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")
-                .path("close").type(MediaType.APPLICATION_FORM_URLENCODED)
-                .post(ClientResponse.class, m);
+        Response response = target().path(API_VERSION).path("index")
+                .path("close")
+                .request()
+                .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 ac69a61..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,14 +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).get(ClientResponse.class);
+                .queryParam("pipes", glemmUri)
+                .request()
+                .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());
 
@@ -150,11 +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).get(ClientResponse.class);
+                .queryParam("pipes", glemmUri)
+                .request()
+                .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());
     }
@@ -174,15 +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)
-                .get(ClientResponse.class);
+                .request()
+                .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());
     }
@@ -191,14 +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).get(ClientResponse.class);
+                .queryParam("pipes", url)
+                .request()
+                .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());
@@ -207,14 +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").get(ClientResponse.class);
+                .queryParam("pipes", "http://glemm")
+                .request()
+                .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());
@@ -229,12 +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).get(ClientResponse.class);
+                .queryParam("pipes", pipeUri)
+                .request()
+                .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);
@@ -246,16 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -282,12 +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).get(ClientResponse.class);
+                .queryParam("pipes", pipeUri)
+                .request()
+                .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);
@@ -306,12 +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).get(ClientResponse.class);
+                .queryParam("pipes", pipeUri)
+                .request()
+                .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);
@@ -334,28 +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)
-                .get(ClientResponse.class);
+                .request()
+                .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")
-                .get(ClientResponse.class);
+                .request()
+                .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 feb6308..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,15 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -38,15 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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());
@@ -56,16 +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")
-                .get(ClientResponse.class);
+                .request()
+                .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 060d441..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,11 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .method("GET");
+        assertEquals(Status.OK.getStatusCode(),
                 response.getStatus());
 
         assertEquals(
@@ -35,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());
@@ -47,14 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -66,13 +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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -87,25 +91,27 @@
 
     @Test
     public void testEmptyStatistics () throws KustvaktException{
-        ClientResponse response = resource().path(API_VERSION)
+        Response response = target().path(API_VERSION)
             .path("statistics")
             .queryParam("corpusQuery", "")
-            .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+            .request()
+            .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")
-                .method("GET", ClientResponse.class);
-        assertEquals(ClientResponse.Status.OK.getStatusCode(),
+                .request()
+                .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());
@@ -116,21 +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);
@@ -143,14 +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);
@@ -161,14 +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());
@@ -179,11 +188,13 @@
     @Test
     public void testGetStatisticsWithoutKoralQuery ()
             throws IOException, KustvaktException {
-        ClientResponse response = resource().path(API_VERSION)
-                .path("statistics").post(ClientResponse.class);
+        Response response = target().path(API_VERSION)
+                .path("statistics")
+                .request()
+                .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 c00084d..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,14 +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").get(ClientResponse.class);
+                .queryParam("engine", "network")
+                .request()
+                .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());
@@ -93,15 +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").get(ClientResponse.class);
+                .queryParam("engine", "network")
+                .request()
+                .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());
     }
     
@@ -109,15 +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").get(ClientResponse.class);
+                .queryParam("engine", "network")
+                .request()
+                .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());
     }
 }