Questions tagged [httpentity]
68 questions
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…

megamind79
- 69
- 3
- 11
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
- 64
- 1
- 6
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,557
- 5
- 19
- 44
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
- 133
- 2
- 10
1
vote
1 answer
Spring - generic method for getting body from ResponseEntity using HttpEntity
In my code I am very often using HttpEntity alongside ResponseEntity in a following way:
HttpEntity> request = new HttpEntity(myObject, headers);
ResponseEntity response = restTemplate.exchange("someurl", HttpMethod.POST, request,…

Zerg
- 739
- 4
- 11
- 22
1
vote
0 answers
Playframework HttpEntity.Streamed/HttpEntity.Chunked Timing
I would like to be able to identify when a stream completes, is cancelled or fails.
I have the following controller action:
def downloadAction(streamer: (String, String) => Future[ Either[ String, Result ] ],snr: String, fName: String ) =…

TheOperative
- 11
- 2
1
vote
1 answer
Mocking response for HTTPGet in Java
I have to mock a request to an API that returns a response with JSON entity
For this I mock the get request as well as the JSON object
public class RestTest {
static JSONObject job;
static JSONArray portsArray;
static JSONArray…

user_mda
- 18,148
- 27
- 82
- 145
1
vote
1 answer
Linking multiple objects to HttpEntity
My rest api uses POST request with 2 object parameters: custom type and long
I can link one parameter to body like this:
private void createCaseParticipant(long caseId, CaseParticipantDTO caseParticipantDTO)
{
HttpHeaders headers = new…

Sviatlana
- 1,728
- 6
- 27
- 55
1
vote
1 answer
Get content from Akka ResponseEntity in Scala
I do a GET HTTP call to a rest service which returns a json. I would like to parse the json to a scala object but here I got stuck. I am using the Akka api and I can't manage to retrieve the content from the Akka's ResponseEntity
Here is my sbt…

GA1
- 1,568
- 2
- 19
- 30
1
vote
0 answers
We are trying to send jsonarray to server using HttpPost in android
We are trying to jsonarray server using HttpPost.
In jsonarrray consists of jsonobjects with prams.
But iam getting null while sending to server.
below code:
class EventPosting extends AsyncTask {
@Override
…

sanjay premnadh
- 11
- 2
1
vote
4 answers
How to fix using native Java libs multiple Http* class and methods deprecated
I have tons of deprecation because of http client related classes.
Here my code:
this.httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url);
HttpResponse response = this.httpclient.execute(httpget);
HttpEntity…

AndreaF
- 11,975
- 27
- 102
- 168
1
vote
1 answer
How to cancel image and video upload like whatsapp
I am uploading an image and video on to a php server, using multipart.
I want to be able to cancel the upload when user presses button like whatsapp.
The progress is shown correctly but I just want to cancel upload on click but I don't know how.…

Pontus Carme
- 176
- 10
1
vote
3 answers
Execute HttpPost with google token in android is not fetching JSON data
HttpPost httpPost = new HttpPost("MyWebsiteURL");
try {
httpPost.setEntity(new StringEntity("https://www.googleapis.com/plus/v1/people/me?key="+token));
HttpResponse httpResponse = httpClient.execute(httpPost);
…

ashokgujju
- 320
- 2
- 4
- 17
1
vote
1 answer
GWAN query string length issue
I am using GWAN (v4.3.14) and facing a strange issue. I am trying to pass some long text in the query string. I have figured out that GWAN does not allow me to pass query parameters beyond a total request size of 537 characters.
It responds with a…

Amco Dev
- 13
- 5
1
vote
3 answers
How to get InputStream back from String
Have a scenario where the httpentity have the binary data of a image in InputStream, for processing further its been converted as String in a library file[String str = EntityUtils.toString(httpResponse.getEntity())] , now am trying to get the input…

Dinesh
- 113
- 2
- 13