Source:
protected CloseableClientResponse getResponse(RequestType requestType, String path, String data, MultivaluedMap<String, String> queryParams, MultiPart mp, Map<String, String> headers, String... acceptedTypes) { WebResource wr = service.path(path); if (queryParams != null && !queryParams.isEmpty()) { wr = wr.queryParams(queryParams); } Builder builder; String[] types = isNotEmpty(acceptedTypes) ? acceptedTypes : new String[] { MediaType.APPLICATION_JSON }; builder = wr.accept(types).header("X-NXDocumentProperties", "dublincore"); if (headers != null && !headers.isEmpty()) { for (Entry<String, String> header : headers.entrySet()) { builder.header(header.getKey(), header.getValue()); } } ClientResponse response; switch (requestType) { case GET: response = builder.get(ClientResponse.class); break; case POST: case POSTREQUEST: if (mp != null) { response = builder.type(MultiPartMediaTypes.createFormData()).post(ClientResponse.class, mp); } else if (data != null) { setJSONContentTypeIfAbsent(builder, headers); response = builder.post(ClientResponse.class, data); } else { response = builder.post(ClientResponse.class); } break; case PUT: if (mp != null) { response = builder.type(MultiPartMediaTypes.createFormData()).put(ClientResponse.class, mp); } else if (data != null) { setJSONContentTypeIfAbsent(builder, headers); response = builder.put(ClientResponse.class, data); } else { response = builder.put(ClientResponse.class); } break; case DELETE: response = builder.delete(ClientResponse.class, data); break; default: throw new UnsupportedOperationException("Type: " + requestType + " is not handled"); } return CloseableClientResponse.of(response); }

Target:
protected CloseableClientResponse getResponse(RequestType requestType, String path, String data, MultivaluedMap<String, String> queryParams, MultiPart mp, Map<String, String> headers, String... acceptedTypes) { WebResource wr = service.path(path); if (queryParams != null && !queryParams.isEmpty()) { wr = wr.queryParams(queryParams); } Builder builder; String[] types = acceptedTypes.length > 0 ? acceptedTypes : new String[] { MediaType.APPLICATION_JSON }; builder = wr.accept(types).header("X-NXDocumentProperties", "dublincore"); if (headers != null && !headers.isEmpty()) { for (Entry<String, String> header : headers.entrySet()) { builder.header(header.getKey(), header.getValue()); } } ClientResponse response; switch (requestType) { case GET: response = builder.get(ClientResponse.class); break; case POST: case POSTREQUEST: if (mp != null) { response = builder.type(MultiPartMediaTypes.createFormData()).post(ClientResponse.class, mp); } else if (data != null) { setJSONContentTypeIfAbsent(builder, headers); response = builder.post(ClientResponse.class, data); } else { response = builder.post(ClientResponse.class); } break; case PUT: if (mp != null) { response = builder.type(MultiPartMediaTypes.createFormData()).put(ClientResponse.class, mp); } else if (data != null) { setJSONContentTypeIfAbsent(builder, headers); response = builder.put(ClientResponse.class, data); } else { response = builder.put(ClientResponse.class); } break; case DELETE: response = builder.delete(ClientResponse.class, data); break; default: throw new UnsupportedOperationException("Type: " + requestType + " is not handled"); } return CloseableClientResponse.of(response); }