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
10
votes
3 answers

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class com.sun.jersey.core.header.MediaTypes

I'm trying to run a jersey client and facing this issue. WS Class: import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import…
anij
  • 1,322
  • 5
  • 23
  • 39
10
votes
3 answers

Restful webservice with jersey 2.0 without maven

Can anybody tell me how to make a restful web service with Jersey 2.0 by not using maven. I have searched everywhere and found tutorial for Jersey1.x versions but not for 2.0. Please help
user2629427
  • 191
  • 2
  • 4
  • 11
9
votes
4 answers

Unable to read application/json message in Response output

I'm testing REST API and while I make GET call to retrieve resources, it's resulting into 500 Internal Server Error and in output it's returning message which has media type application/json: [ { "messageType": "Some error type", …
Alpha
  • 13,320
  • 27
  • 96
  • 163
9
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,985
  • 10
  • 51
  • 82
9
votes
2 answers

Jersey Client non-blocking

Spawning lots of threads is never a good idea (and when you create too many, you may run out of memory anyway). Usually, Jersey needs to create one thread per request. And this seems to be the case, whether I use async() (where Jersey creates the…
Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
9
votes
4 answers

How to enable gzip compression for content encoding with Jersey (JAX-RS 2.0) client?

I have a Java application that uses the Jersey implementation of JAX-RS 2.0 and I want to enable gzip compression on the client side. The server has it enabled and I have verified that by looking in Chrome at the "Size/Content" in the Developer…
Jason
  • 11,709
  • 9
  • 66
  • 82
9
votes
1 answer

Jersey Client post binary data application-octet/stream

I would like to perform a post with binary data using Jersey Client. The equivalent with curl would be: curl -v --header "Content-Type:application/octet-stream" --data-binary "abc" http://example.com I could not find how to do it in the official…
fernandospr
  • 2,976
  • 2
  • 22
  • 43
9
votes
4 answers

What is the Jersey 2.0 equivalent of GZIPContentEncodingFilter

I am in the progress to migrate a Jerset 1.x client project to Jersey 2.0. I found that GZIPContentEncodingFilter does not exist any longer. Is there something similar? I stumbled over GZIPEncoder but am not sure how to plug it in. In Jersey 1.17 I…
Frederick Roth
  • 2,748
  • 4
  • 28
  • 42
8
votes
1 answer

Jersey client Post Request with x-www-form-urlencoded Fails

Hi I am using Glassfish jersey-client to get oauth-Token from REST URL. I am able to get the token via postman client & CURL,please find the below image for reference, $ curl 'https://sample.com/oauth2/token' -X POST…
VelNaga
  • 3,593
  • 6
  • 48
  • 82
8
votes
1 answer

How can I use jersey-client with Apache httpclient underneath?

I am using jersey-client for a project and would like to make the Client use an HTTP client from the Apache httpclient librabry. I have previously see this is possible. I'm using Jersey 2.20.
carlspring
  • 31,231
  • 29
  • 115
  • 197
8
votes
1 answer

ClientBuilder class not found

I am trying to build a RESTFul client using Jersey framework, so I added the following class: import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; public class ActivityClient { private Client client; public…
MChan
  • 6,842
  • 27
  • 83
  • 132
7
votes
3 answers

How do I get Jersey Test/Client to not fill in a default Accept header?

I'm trying to handle a request with no Accept header in a particular way, but Jersey seems hell-bent on filling one in, no matter what I do, so it always looks like the request has an Accept header, even if it doesn't. import…
postfuturist
  • 22,211
  • 11
  • 65
  • 85
7
votes
3 answers

Jersey resource receiving duplicate requests from Jersey client

We recently upgraded from Jersey 1.x to Jersey 2.22.1 on both Server and Clients. We are now seeing intermittently Jersey will make/receive two requests. By intermittent I mean every 1 out of several thousand requests. We never experienced this…
Justin
  • 6,031
  • 11
  • 48
  • 82
7
votes
0 answers

javax.ws.rs.client.Entity json() to String

I'm using Jersey to post some entities to a remote REST service through json, here is the client: Invocation invocation = buildingWebTarget.request(MediaType.APPLICATION_JSON). buildPut(Entity.json(tmpEntity)); at the other…
sarah.ferguson
  • 3,167
  • 2
  • 23
  • 31
7
votes
1 answer

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,547
  • 10
  • 47
  • 78
1 2
3
54 55