Questions tagged [httpentity]

65 questions
109
votes
5 answers

Working POST Multipart Request with Volley and without HttpEntity

This is not really a question, however, I would like to share some of my working code here for your reference when you need. As we know that HttpEntity is deprecated from API22 and comletely removed since API23. At the moment, we cannot access…
BNK
  • 22,674
  • 8
  • 69
  • 81
5
votes
2 answers

How to send multipart request using Volley without HttpEntity?

I am following the solution to send multi-part request using volley from How to multipart data using Android Volley. But, since SDK 22, httpentity is deprecated and it's removed completely on SDK 23. The solution is to use openConnection, just like…
Spino
  • 99
  • 1
  • 5
4
votes
2 answers

Get the JSON from HttpEntity

I am using akka.http.scaladsl.model.HttpResponse, HttpEntity. After getting the response , it is of type responseEntity of the format (Content-type: 'application/json', {MyJSONHERE}). Is there a way I can extract my json from the entity. I tried…
Nagireddy Hanisha
  • 870
  • 2
  • 14
  • 31
3
votes
0 answers

Upgrading to Spring 5 broke RestTemplate MultipartFile upload

I upgraded from Spring 4.3.16 to Spring 5.0.7. When trying to upload a file using the restTemplate I started to get a "400 - Bad Request". After messing around the only difference in behavior I noticed was removing requestEntity from the exchange…
Joe A
  • 170
  • 8
3
votes
0 answers

Premature end of Content-Length delimited message body (expected: 3233986; received: 0)

HttpWithEntity requestEntity = new HttpWithEntity(endPointUrl); requestEntity.addHeader("Cookie", "session_id=" + session.getSessionId()); requestEntity.setMethod("PUT"); StringEntity rse = new…
Jijesh Kumar
  • 299
  • 2
  • 13
3
votes
2 answers

Get image content from httpResponse in Android

Am trying to get a image from a http response, but am failing to convert the stream to bitmap. Please let me know, what am i missing here. FYI - the image content is received as raw binary & its a jpeg image. Procedure followed: Make…
Dinesh
  • 113
  • 2
  • 12
2
votes
2 answers

StringEntity/string to HttpEntity

I'm using the loopj library (https://github.com/loopj/android-async-http) and it's recently changed to be compatible with API 23. When submitting a 'put' request I would pass the StringEntity into the put method like…
Murphybro2
  • 1,539
  • 13
  • 30
2
votes
1 answer

How to update HttpEntity content?

I have a HttpServletResponse. I'd like to get the content of its entity, change it and then send the response. Getting the content and changing it is simple : response.getEntity().getContent() But writing back the modifications into the entity, ...…
yo_haha
  • 329
  • 1
  • 4
  • 14
2
votes
0 answers

EntityUtils.toString(entity) is very slow

I am fetching a page with a lot of xml. When I say a lot, I mean a little in terms of computing (~600 KB). For a reason I am unaware of, running EntityUtils.toString(entity) to turn the xml document (httpGet -> URL -> XML) takes about a half hour…
bneigher
  • 778
  • 4
  • 10
  • 23
1
vote
1 answer

Converting from DescribeSObjectResult to JsonArray (or to HttpEntity)

A couple of weeks ago, I asked a question about reading Salesforce data using the SOAP API instead of the REST API (see Trying to use Apache Gobblin to read Salesforce data using SOAP API(s) instead of REST API ), but unfortunately nobody answered…
Marc K.
  • 11
  • 4
1
vote
2 answers

BadRequest 400 while trying to call a external API using POST RestTemplate

I have to call an external API in Java Spring in which I have to pass a JSON object as follows( XXX and YYY are parameters ).How can I pass this JSON object using the following classes? { "codecConfigId": "XXXXXXXX", "inputStreams": [{ …
1
vote
0 answers

How to use RestTemplate to make a POST call with a request body

I'm trying to make a POST request using RestTemplate to send a request body and headers. To do this, I saw that many are using HTTPEntity class. But this class a generic type which needs to be passed. The content type is application/json. In most…
1
vote
0 answers

Spring MVC - Data Page formatted as JSON, getting error: unable to infer type arguments for ResponseEntity<>

I am following the first answer to this question : Spring MVC 3: return a Spring-Data Page as JSON I am getting compilation error Cannot infer type arguments for ResponseEntity<> in the following block of code :…
Clay
  • 38
  • 1
  • 5
1
vote
1 answer

Why LocalDate format changed when I transform entity to Json?

My objective is to store dates into a database. To do this app I use Springboot, JPA, H2, ... I use LocalDate and the format wished is yyyy-MM-dd. Entity @Entity public class MyObject { @Id private String id; private LocalDate…
Royce
  • 1,267
  • 1
  • 11
  • 31
1
vote
1 answer

RestTemplate invocation error

I have postman body as attached in the image I am trying to call restTemplate as follows. String body= "client_id=admin-cli&username=abc&password=root&grant_type=password"; HttpHeaders headers = new…
sumit
  • 113
  • 1
  • 9
1
2 3 4 5