Questions tagged [response-entity]

35 questions
0
votes
1 answer

Easiest way to return a custom ResponseEntity<>(HttpStatus.BAD_REQUEST) with custom message?

This is the first time I develop a REST API with Spring Boot. I want to return a custom message when I have a Bad Request 400 error. I have my controller: @GetMapping("/DetailDossier/{id},{parameters}/") public…
tuniodu33
  • 5
  • 3
0
votes
0 answers

Spring Boot Annotations cannot be found

I've created a new Spring Boot project with the Spring Initializr and implemented a REST API with the Spring Boot RestController annotation. Errors occurred regarding the import and usage of the ResponseEntity class after adding a React Frontend…
lu_lu
  • 133
  • 12
0
votes
1 answer

Open Pdf file on web page in Spring boot

@GetMapping(value = "/pdf",produces= MediaType.APPLICATION_PDF_VALUE) public ResponseEntity getTermsConditions() throws Exception { String filePath = "C:\\"; String fileName = "PDF.pdf"; File file =…
javaUser
  • 1
  • 1
  • 3
-1
votes
2 answers

How to handle a list of resources with ResponseEntity

I have an external REST API that returns a list of client objects as json. For example: GET externalapi.io/api/clients [ { "id" : "b15asgdc-6efd-4a2d-re08-2q3r3bae", "clientName" : "test1", ... }, { "id" :…
KJ0797
  • 187
  • 1
  • 2
  • 14
-1
votes
1 answer

ResponseEntity for Generic Object not giving empty response

When returning the response from controller in ResponseEntity for class B. But it returns empty json response. controller method is below: @PostMapping("/test") public ResponseEntity testSave(@Valid @RequestBody ReqData req, BindingResult…
user404
  • 1,934
  • 1
  • 16
  • 32
1 2
3