Questions tagged [jersey-client]

The Jersey client API is a high-level Java based API for interoperating with RESTful Web services.

The Jersey client API is a high-level Java based API for interoperating with RESTful Web services. It makes it very easy to interoperate with RESTful Web services and enables a developer to concisely and efficiently implement a reusable client-side solution that leverages existing and well established client-side HTTP implementations.

More Details

820 questions
2
votes
0 answers

How to throw error specific exception based on response status in Jersey?

Here is my current code: WebTarget resource = client.target(restEndpointURL); Response response = resource.request().delete(); if (response.getStatusInfo() != Status.OK) { String message = String.format("some meaningful error message"); …
vatsal mevada
  • 5,148
  • 7
  • 39
  • 68
2
votes
0 answers

How to implement Junit test for rest client program which calls external rest service api

Having Rest Client program: - Create client object using Jersey libraries - Invokes the external rest services using URL. - read the response and process the response. public String getResourceFromService() { ClientConfig clientConfig = new…
sunjavax
  • 91
  • 1
  • 6
2
votes
0 answers

Jersey Rest Returning 400 for file upload/multipart

Test Case Using this test case to upload file and form data final Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build(); WebTarget t =…
2
votes
1 answer

Can not register jersey MultiPartFeature

I'm trying to create a test case for my Jersey REST application. I added already in pom.xml: org.glassfish.jersey.media jersey-media-multipart
dadoonet
  • 14,109
  • 3
  • 42
  • 49
2
votes
1 answer

In Jersey 2, why was queryParams(map) taken away from WebTarget?

I'm doing a migration from Jersey's Client API (https://jersey.java.net/documentation/latest/client.html) 1.x to 2.x, and the queryParams(map) method of WebResource did not make it over to WebTarget, or it's Builder, or it's Invocation. There's…
mojo-jojo
  • 145
  • 1
  • 1
  • 7
2
votes
2 answers

RxJava jersey client with proxy built with WebResourceFactory

Does anyone have a clue how to build a reactive rx java client using the client proxy? The official documentation: https://jersey.java.net/documentation/2.23.2/rx-client.html only provides examples with building an rxclient manually from WebTarget…
dziadeusz
  • 21
  • 3
2
votes
2 answers

Dropwizard client deal with self signed certificate

Quite new with Dropwizard. I found a lot of solution to deal with Jersey and ssl self signed certificate. Dropwizard version is 0.9.2 I have tried to set a SSLContext but I get The method sslContext(SSLContext) is undefined for the type…
Ôrel
  • 7,044
  • 3
  • 27
  • 46
2
votes
1 answer

How to increase timeout while making a REST call from a Java jersey client?

I am making a REST call which takes around 2 or 3 minutes to respond, but I am getting a connect timed out exception. How do I increase the timeout for the REST call that is being made. Here is the code snippet, Client restClient =…
dwarakesh tp
  • 127
  • 4
  • 13
2
votes
1 answer

Adding query parms to WebTarget with Jersey Client 2.x

I'm trying to add query params to WebTarget of Jax-RS(Jersey Client 2.x) as below public WebTarget webTarget(String path, Map queryMap) { WebTarget webTarget = client.target(this.address.getUrl()).path(path); if…
Somasundaram Sekar
  • 5,244
  • 6
  • 43
  • 85
2
votes
0 answers

Error passing InputStream through multiple Jersey-Client requests

I’m using jersey-client v1.18.1 I need to make 2 sequential requests where the 1st request has an InputStream and then must pass that same InputStream along to the 2nd request (eg. sort of like a proxy). The 2nd request will then write the…
kpschmidt
  • 245
  • 3
  • 10
2
votes
0 answers

Jersey unit test returns 404

I am trying to get a simple unit test to work, however it returns a 404 status. Enpoints Class: @Path("/v1") public class Endpoints { @Context private HttpServletResponse servletResponse; private void allowCrossDomainAccess() { …
rj93
  • 523
  • 8
  • 25
2
votes
1 answer

How do i send a POST request without Transfer Encoding:chunked from Jersey ReST Client 2.22.2

When i send a POST request through Jersey ReST client it's automatically using Header transfer-encoding: [chunked]. Is there any way to force use of content-length: instead of transfer-encoding.? WebTarget webTarget =…
Rohit
  • 635
  • 6
  • 12
  • 22
2
votes
1 answer

"Already connected" Exception when running jersey application inside docker container

I am trying to dockerize a jersey application which acts both as a REST server and client. The application seems to behave differently when running inside a docker container. I am able to perform a request to a non-dockerized service (A). The…
stelios
  • 2,679
  • 5
  • 31
  • 41
2
votes
1 answer

Jersey Client DELETE hangs on second call

Calling Rest service using Jersey Client using Apache Connector provider. My POST, GET and DELETE calls are successful. However, after calling Account DELETE any subsequent calls are hanging. Here is my code. In the below case second DELETE call is…
Vividh S V
  • 131
  • 1
  • 7
2
votes
1 answer

Jersey Client giving two sets of results when executed in Tomcat and Websphere Liberty Profile

I have written a RESTful Client using Jersey 2.15 and invoking IBM Watson's RankRetrieve(R&R) Service. The code snippet works out of Eclipse environment as well as a WAR deployed out of Tomcat 7 and fetches the result JSON from the R&R…
user6083088
  • 1,047
  • 1
  • 9
  • 27