Questions tagged [response-entity]

35 questions
0
votes
1 answer

RestTemplate Post and response ( JSON ) Spring boot

I am implementing a post with restTemplate, with body an object representing a fields of a json and I would like the answer with an object representing the json fields of the answer itself. For example, the json is this: { "content": { …
0
votes
0 answers

Error while parsing the data I saved in the database with the ResponseEntity

I save the ResponseEntity to the database as a String, then when I read it again and parse it, it comes as a Byte. column in database Data Type: CLOB Entity Field @Column(name = "RESPONSE") @Lob @Type(type = "org.hibernate.type.TextType") private…
zoroglur
  • 395
  • 2
  • 18
0
votes
1 answer

Spring batch exception handling sended as ResponseEntity

I'm new in Spring boot, I'm training on a small project with Spring batch to get experience. Here my context: I have 2 .csv files, one holds employees, the other contains all managers of the company. I have to read the files, then add each record in…
0
votes
1 answer

ResponseEntity not producing any output to curl or postman

Having an odd issue where I am able to send requests to my local spring boot web api via CURL i.e curl -X POST -H "Content-Type: application/json" -d '{"userName":"bob","textMessage":"newMessage","timeOut":500}' http://localhost:8080/chats curl -X…
Geogrio
  • 113
  • 2
  • 15
0
votes
0 answers

How do I return Http Response Content Length for ResponseEntity> without formatting issues or losing data from my response body?

I'm trying to set the content length of my ResponseEntity but the full list isn't returned in the response. I tried something like long contentLength = staticMethodGetsContentLength(List objectList); HttpHeaders headers = new…
adamB
  • 43
  • 5
0
votes
0 answers

Response entity return header in the response

I'm returning a list of error messages using a ResponseEnitiy body method. Altough I'm not sure why it's returning header object on the top of the reponse Ex: [ { "headers": {}, "body": { "code": 6, "description": "Billing…
TechNewPy
  • 23
  • 4
0
votes
2 answers

FeignException com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.springframework.http.ResponseEntity`

Any Help please !! I receive this error when I'm calling my endpoint which call Feign in the background : com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.springframework.http.ResponseEntity` (no…
0
votes
1 answer

How can we convert below code without lambda expressions and streams?

How to convert below code to for each loop without using lambda expressions and streams in Java? @Override protected ResponseEntity handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus…
0
votes
1 answer

Extract Object From Response Entity

I am working to hit API through Rest Template and I have successfully received the response in responseEntity form. Now my requirement is to extract values from response to my object. String uri = "http://192.168.1.113:10100/scf/reset"; String str =…
0
votes
0 answers

How to mock the optional ResponseEntity code below for code coverage. Could someone please assist?

public ResponseEntity getData(@RequestBody RequestModel requestModel) { try { List mango = new ArrayList(); mangoRepository.findByMangoTag( requestModel.getMangoTag(), …
0
votes
0 answers

Returning a Mono> keeps the request unending

@RequestMapping(value = "/search", method = RequestMethod.GET) public Mono> getStore(@RequestParam MultiValueMap params) return getItem(params); } public Mono>…
looke
  • 41
  • 1
  • 8
0
votes
0 answers

Mapping Json String Response To Pojo Class

I want to convert my string response to POJO Class. I have already created a POJO Class named account with the below variable but can't map the response to it. My Response [ { "accountNumber": "12345", "accountType": "Banking" }, { "accountNumber":…
0
votes
1 answer

How to cache ResponseEntity in spring boot

I am trying to cache ResponseEntity in spring boot but unable to find a proper way to implement the same. There are few examples where return ResponseEntity.ok() .cacheControl(CacheControl.maxAge(20, TimeUnit.SECONDS)) …
0
votes
1 answer

MessageBodyWriter not found StreamingBodyResponse

I am trying to make StreamResponseBody work with sample hardcoded data. @POST @Path("filetypecsv") @Produces("text/plain") public ResponseEntity studentsFile() { String name = "name"; String rollNo = "rollNo"; …
KudmiSubba
  • 59
  • 2
  • 9
0
votes
0 answers

SpringBoot | Getting null after success response body when request with token

Returning a response in SpringBoot project like this: @GetMapping("/users") public ResponseEntity> getUsers() { return ResponseEntity.ok(adminService.getUsers()); } AdminService method: @Override public List getUsers() { …