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
1 answer

java.net.ProtocolException: HTTP method DELETE doesn't support output

I am having this error while using jersey-client-1.19. All the googling I have done points to a bug or unnecessary limitation in HttpUrlConnection, especially in java 7. I have been advised by some to move to java 8, I am not ready for that now. I…
egimaben
  • 653
  • 7
  • 22
2
votes
2 answers

jersey client get error message body

I am using the following code to consume a rest post service Client client = ClientBuilder.newClient(); WebTarget target = client.target("wrong url"); Invocation.Builder builder = target.request(MediaType.APPLICATION_JSON); Response response =…
LynAs
  • 6,407
  • 14
  • 48
  • 83
2
votes
1 answer

Access HTTP response when using Jersey client proxy

I'm using Jersey 2.22 to consume a REST api. The approach is contract-first, a service interface and wrappers are used to call the REST api (using org.glassfish.jersey.client.proxy package). WebClient webClient = ClientBuilder.newClient(); …
tigrou83
  • 157
  • 10
2
votes
0 answers

How to selectively GZIP encode POST and PUT requests

I'm using Jersey on both the server and client of a web application. On the server I have Interceptors as noted in https://jersey.java.net/documentation/latest/filters-and-interceptors.html to handle GZIP compression going out and coming in. From…
Domenic D.
  • 5,276
  • 4
  • 30
  • 41
2
votes
0 answers

Jersey jax-rs client proxy doesn't marshall object when doing a POST

I'm trying to use the jersey client proxy for doing a POST to an endpoint, but the object that I send in doesn't get marshalled into json. The interface looks like this: public interface Authentication…
Alexander Kjäll
  • 4,246
  • 3
  • 33
  • 57
2
votes
1 answer

Jersey-Client 1.2 - Jersey Client Performance Issue

I am using jersey-client-1.2 to access EHCache REST APIs to put/get my own custom objects. Jersey Maven Dependency: com.sun.jersey jersey-client
Narendra Verma
  • 2,372
  • 6
  • 34
  • 61
2
votes
0 answers

Jersey client doesn't redirect properly on 301 response (after PATCH)

I use a Jersey client to make a request to an API to change the ID of a resource, using the PATCH method: Client client = ClientBuilder.newClient() .property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // To allow PATCH ... // Setting…
Maxime Laval
  • 4,068
  • 8
  • 40
  • 60
2
votes
2 answers

Jersey custom JSON responses

I am designing a web service using Jersey and I need to add some custom fields to my JSON response always, similar to this: { "result": "0"/"Error code", "message": "Message returned by server", "custom_field": here goes string or class…
Angel F.
  • 176
  • 1
  • 16
2
votes
2 answers

Jersey client 1.17 PUT request returns Error 411. The request must be chunked or have a content length

I am trying to create an empty PUT request in Jersey 1.17 to communicate to Azure Storage REST api like this HTTPClient ClientConfig config = new DefaultClientConfig(); config.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, …
2
votes
1 answer

Sending Multipart json String with Jersey 2

I want to write a Java REST Client that uploads a json String. I have a description about the webservice and a C++ Code but that doesn't help me. Unfortunately, the solutions I found online doesn't work for me. The description of the webservice…
hueami
  • 113
  • 1
  • 8
2
votes
1 answer

Using Jersey 2.x client, how can I read from an InputStream while the server is still writing to its OutputStream?

We recently upgraded from Jersey 1.x to 2.x and most of the migration went smoothly. There's one snag though. In 1.x, the following code would let us grab the InputStream while the server was still writing to its respective OutputStream: final…
asmodean
  • 185
  • 3
  • 11
2
votes
0 answers

javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake -WebResource

I have a class which generates XMLs and sends those XMLs and then redirects to a servlet. Below is the code snippet. For security reasons, changed the class name. public static void connectToApp(MyClass responseVO) { AppHttpClient client =…
JAVA_CAT
  • 737
  • 3
  • 13
  • 33
2
votes
2 answers

How do I configure the jersey client to use the same json format that the server expects?

This is the json I need (generated by Ember, but works on the server): {"customer":{"partyType":"jdo.party.model.Organization","name":"asdf"}} This is the json I'm getting: {"id":null,"partyType":"jdo.party.model.Company","name":"Test…
Jim Barrows
  • 3,634
  • 1
  • 25
  • 36
2
votes
1 answer

Jersey client unable to convert ArrayList to xml

I have developed one restful webservice using jersey and spring. Below is the service method which servers the request by accepting the list of Login objects. Method in service class @POST @Path(value =…
mevada.yogesh
  • 1,118
  • 3
  • 12
  • 35
2
votes
2 answers

How to exclude jersey 1.x dependencies when running tests with gradle

We have a web service project that relies on Netflix's Eureka and it has a dependency on Jersey client 1.x. Our project is using gradle and in the project we have our src, unit, integration, and functional tests. For our functional tests we have a…
twreid
  • 1,453
  • 2
  • 22
  • 42