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

807 questions
6
votes
2 answers

How to implement a retry mechanism in jersey-client java

I am doing some http rest api calls using jersey-client. Now I want to do a retry for a failure request. Say if the return error code is not 200 then I want to retry it again for a few times. How can do it using Jersey client
ѕтƒ
  • 3,397
  • 9
  • 41
  • 75
6
votes
1 answer

Jersey Image Upload Client

I am trying to upload image using Jersey webservice , i am using jersey client to upload image. below is jersey web service which takes inputstream and uploads image on server. it works fine when i directly call it using jsp multipart form upload…
Jitendra Kumawat
  • 123
  • 1
  • 2
  • 11
6
votes
2 answers

How to use mockito for testing Database connection

I am using Junit to test my jersey api. I want to test DAO without a database. I tried using Mockito but still not able to use mock object to test the DAO which contains Hibernate calls to DB. I want to write Junit for my Helper class which calls…
Jugi
  • 1,164
  • 3
  • 20
  • 42
6
votes
1 answer

Glassfish :MessageBodyProviderNotFoundException in Jersy Client

Hi All I was trying to create a rest web-service from scratch. Here is my Service part @Path("/Phones") public class PhonessResource { @GET @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) public Response getAllNumbers(){ …
edwin
  • 7,369
  • 10
  • 45
  • 74
6
votes
3 answers

java.lang.NoClassDefFoundError error when running my project

I have been struggling to get this to work and I think i can use some help. I am working on a Java project where the pom.xml has a bunch of dependencies some of which are themselves indirectly dependent on this jar: com.sun.jersey:jersey-core:1.17.1…
user352951
  • 261
  • 1
  • 4
  • 11
6
votes
4 answers

Jersey2 Client throwing javax.ws.rs.NotFoundException

I have written a sample REST service using Jersey2. Here is my web.xml: jerseysample Jersey REST Service
Prasanth
  • 885
  • 5
  • 16
  • 38
5
votes
0 answers

javax.ws.rs.ProcessingException: java.net.SocketTimeoutException - Jersey Client

I am attempting to read a REST web service response in a client and it works fine for individual calls. While doing the load test (~5000 calls in 5 minutes) for same web service call, I am getting socket read time out error. The bigger problem is,…
satz
  • 51
  • 1
  • 4
5
votes
2 answers

AsyncInvoker not releasing the Thread

I am using AsyncInvoker using Jersey 2.0. This works fine for me. However, thread is not ending after completion of the return. Please note that I don't expect any response for the services I call. public Future fire(WebTarget webTarget)…
krutik
  • 119
  • 4
5
votes
1 answer

Jersey Client closing InputStream response - does it really work?

I am using Jersey Client v2.16 (a transitive dependency of Dropwizard 0.8.0, which I am using, too). I am somehow puzzled by the closing mechanism of a response when the entity is read as an InputStream. The documentation states: Also if the…
Andrei Nicusan
  • 4,388
  • 1
  • 20
  • 35
5
votes
1 answer

Upgrading from Jersey Client 1.x to Jersey Client 2.x

I am using jersey-client-1.9. sample code: import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; Client client = Client.create(); webResource =…
Dev
  • 11,996
  • 15
  • 57
  • 138
5
votes
1 answer

Jersey Client 2 proxy and multipart support

I am trying to add proxy support to my Jersey Client. I use org.glassfish.jersey.core:jersey-client:2.11 but I can switch to any Jersey Client 2 version. Currently the client uses the default Jersey connector which does not support proxy AFAIK. I…
5
votes
2 answers

Jersey client async POST request to not wait for response

I have created a simple Jersey client and it is able to successfully do a POST request with a payload. But right now it waits for a response from the http endpoint: public void callEndpoint(String endpoint, String payload) { try { …
Sumitk
  • 1,367
  • 5
  • 18
  • 29
5
votes
3 answers

java.lang.ClassNotFoundException: javax.ws.rs.MessageProcessingException

I am deploying a war to Tomcat 7.0.57. This code uses Jersey 2.x Client to communicate with a Rest endpoint and exposes its own Rest endpoints using CXF (AKA the war's endpoint). When I hit one of the war's endpoints, the code seems to work and…
Daniel Kaplan
  • 54,448
  • 39
  • 189
  • 282
5
votes
0 answers

Jersey Client: Sending trailers in HTTP request with chunked transfer

I am implementing a java client to upload large files to the Akamai NetStorage Version 4 (Object Storage) via HTTP API. When using chunked transfer, the API requires trailing headers (trailers) to be send at the end of the message body. Currently I…
akyras
  • 51
  • 1
5
votes
0 answers

Jersey 2.7 - setting retry handler

I would like to set a retry handler for Jersey client utilizing ApacheConnector. I wish to do it, because I want it to retry on timeout (my HAProxy will switch it to another server). I have no clue how to do this in Jersey 2.7. Example code: public…
Michał Kowalczyk
  • 329
  • 1
  • 2
  • 18