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

How do Jersey-client and Apache HTTP Client compare?

First of all, I'm not trying to start a flame-war here. I know Jersey sufficiently well, but have hardly used httpclient. What are the key differences between jersey-client and Apache's httpclient? In what areas is one better than the other? Is…
36
votes
2 answers

Is java Jersey 2.1 client thread safe?

Documentation for jersey 2.0 says: Client instances are expensive resources. It is recommended a configured instance is reused for the creation of Web resources. The creation of Web resources, the building of requests and receiving of …
jakub.piasecki
  • 536
  • 1
  • 5
  • 12
35
votes
5 answers

Post empty body with Jersey 2 client

How do I submit a post request with an empty body with a Jersey 2 client? final MyClass result = ClientBuilder.newClient() .target("http://localhost:8080") .path("path") .queryParam("key", "value") .request(APPLICATION_JSON) …
Stine
  • 1,535
  • 5
  • 20
  • 43
31
votes
4 answers

How to get list as response from jersey2 client

I want to know how I can extract a List as response from the jersey-2.0 client. I have already tried this, List list = client .target(url) .request(MediaType.APPLICATION_JSON) …
Saurabh
  • 6,001
  • 3
  • 38
  • 40
29
votes
3 answers

jersey - StreamingOutput as Response entity

I had implemented streaming output in my Jersey Resource class. @GET @Path("xxxxx") @Produces(BulkConstants.TEXT_XML_MEDIA_TYPE}) public Response getFile() { FeedReturnStreamingOutput sout = new FeedReturnStreamingOutput(); response =…
PrabhaT
  • 828
  • 3
  • 9
  • 22
26
votes
1 answer

how to send json object from REST client using javax.ws.rs.client.WebTarget

I have a POJO given below which I want to PUT to the server as JSON or XML. This is what I have done CLIENT: ClientConfig config = new ClientConfig(); Client client = ClientBuilder.newClient(config); WebTarget target =…
user3275095
  • 1,425
  • 4
  • 20
  • 32
25
votes
2 answers

Jersey REST client with Apache HTTP Client 4.5 vs retrofit

I was reading many articles to find the best Rest Client for java application, I found finally using Jersey with Apache HTTP client 4.5 is great but in a lot of articles I found that now Retrofit is the best (I didn't mention Volley because in my…
Chris Sim
  • 3,584
  • 3
  • 26
  • 32
23
votes
2 answers

jersey NoClassDefFoundError: org/objectweb/asm/ClassVisitor exception

First time I'm trying a WebService using jersey. The below code I got from some blog. I am getting following 500 error when I'm trying Java Web service using jersey client javax.servlet.ServletException: Servlet.init() for servlet Jersey Root REST…
user2502314
  • 243
  • 1
  • 3
  • 6
22
votes
2 answers

How to resolve MessageBodyWriter not found for media type=multipart/form-data error

How to configure provider for simple multi-form post. Any suggestions/pointers would be much appreciated. Stacktrace: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media…
Doug
  • 2,022
  • 2
  • 17
  • 16
20
votes
4 answers

PATCH request using Jersey Client

I want to execute a PATCH request supported by our server for testing using Jersey client. My code is as below, but I get com.sun.jersey.api.client.ClientHandlerException: java.net.ProtocolException: HTTP method PATCH doesn't support output…
nilesh
  • 13,329
  • 5
  • 59
  • 76
18
votes
1 answer

Using SSLContext with just a CA certificate and no keystore

I need to setup a javax.net.ssl.SSLContext for use in a Jersey-Client application. All I want to do is the context to accept a custom root ca certificate. Is is really true that there is no way around of generating a keystore file and importing the…
Remo
  • 2,160
  • 2
  • 20
  • 33
17
votes
6 answers

How to add a http proxy for Jersey2 Client

It's easy to set a proxy for client on Jersey1.x: config.getProperties().put(ApacheHttpClientConfig.PROPERTY_PROXY_URI, proxyUrl); But how to add a http proxy for Jersey2.x client? I checked the source code and didn't find the implementation does…
feuyeux
  • 1,058
  • 1
  • 9
  • 22
14
votes
1 answer

Jersey version issue: MessageBodyReader not found for media type=application/xml

While writing a simple Jersey client that was consuming XML data, I came across this exception "MessageBodyReader not found for media type=application/xml". All of my settings, including the jersey-client as maven dependencies was just fine. The…
Anant
  • 416
  • 1
  • 4
  • 8
14
votes
1 answer

Jersey ClientResponse.getEntity of generic type

I got a problem to deserialize using jeresy ClientRespone.getEntity I've tried to follow some tutorials and questions, include…
user2212726
  • 995
  • 3
  • 13
  • 22
13
votes
2 answers

REST service that accepts and returns object. How to write client?

I have declared two REST web services. One which simply returns a object. And other which accepts an object and returns another object. POJO Order.java is used. @XmlRootElement public class Order { private String id; private String…
Kaushik Lele
  • 5,681
  • 9
  • 44
  • 68
1
2 3
53 54