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
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
  • 10,225
  • 8
  • 57
  • 79
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,541
  • 1
  • 18
  • 37
8
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
  • 11,340
  • 19
  • 67
  • 116
8
votes
2 answers

How to avoid dependency conflict when using dropwizard + jersey client

I have a DropWizard REST API written and works. One of the resource endpoints actually writes an email, however as soon as I add the following dependencies DropWizard starts to fail on start up com.sun.jersey
Manish Patel
  • 4,049
  • 4
  • 21
  • 42
8
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
  • 36,020
  • 19
  • 96
  • 128
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,242
  • 25
  • 73
  • 127
8
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,193
  • 5
  • 20
  • 35
8
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,659
  • 4
  • 24
  • 42
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
  • 20,913
  • 11
  • 57
  • 84
7
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
  • 2,767
  • 5
  • 29
  • 72
7
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
  • 27,224
  • 23
  • 101
  • 178
6
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
  • 5,463
  • 9
  • 41
  • 74
6
votes
1 answer

PathParam for Jersey WebResource

I'm working on a task to create a Jersey client. I'm using Jersey 1.18. The target URL looks like below. https://api.test.com/test/{id}?param1=test1¶m2=test2 I need to add a PathParam to my WebResource to call this URL. I see an option to add…
Jane
  • 127
  • 1
  • 9
6
votes
5 answers

Encoding curly braces in Jersey Client 2

We are using Jersey Client 2.21. I am noticing that when we put curly braces (aka curly brackets) as a param value, then it does not get properly encoded. Not only that, but anything inside the curly braces does not get encoded either. This is…
Jose Martinez
  • 9,918
  • 6
  • 41
  • 60
6
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
  • 2,847
  • 1
  • 20
  • 27
1 2
3
53 54