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
56
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…
38
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
  • 556
  • 1
  • 5
  • 12
36
votes
3 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
  • 7,525
  • 4
  • 45
  • 46
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,605
  • 5
  • 23
  • 44
30
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
  • 858
  • 3
  • 10
  • 22
28
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,605
  • 4
  • 24
  • 36
27
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
  • 4,054
  • 4
  • 29
  • 36
26
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,242
  • 2
  • 20
  • 16
24
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…
sudoremo
  • 2,274
  • 2
  • 22
  • 39
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
21
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
  • 14,131
  • 7
  • 65
  • 79
18
votes
7 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,158
  • 1
  • 9
  • 26
15
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
  • 1,356
  • 1
  • 11
  • 9
15
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
  • 1,225
  • 3
  • 16
  • 23
14
votes
4 answers

Error while using jersey-client in osgi - No generator was provided

I get the following exception when I try to create a WebTarget from a Jersey client. My code Client client = ClientBuilder.newClient(); WebTarget baseTarget = client.target("http://127.0.0.1:9000"); Exception stack…
jubi
  • 143
  • 1
  • 1
  • 5
1
2 3
54 55