Questions tagged [response-entity]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

Jhipster : Rest API should return JSON with 2 level depth relationship

I have a Jhipster web application, and I have a (native jhipster) rest GET API Resource, returning a ResponseEntity<List> data which are converted to JSON on frontend (for the native webpage ...
François's user avatar
1 vote
1 answer
80 views

GlobalExceptionHandler with @ExceptionHandler or ResponseEntity for REST answer from the server?

I've found two approaches of returning error status codes from RESTful API: the first is traditional using ResponseEntity<>. The second one is to create specific exceptions for status codes and ...
Crystal2033's user avatar
0 votes
0 answers
44 views

Two possible responses on the same endpoint

My application has an aspect that checks if the request is duplicated within a TTL and returns the endpoint result or a message. This is my controller @RestController @RequestMapping("/results/...
Manzini's user avatar
  • 1,791
0 votes
0 answers
41 views

Rest Spring boot converts a response with duplicate object to id of that object

I write a rest spring boot that return List<Map<String,Object>> as response. public List<Map<String,Object>> getAll(@Valid DataRequestDto dto) { List<Map<...
Fahimeh Golzari's user avatar
0 votes
0 answers
36 views

StreamingResponseBody body not executing body returning immeditly - but Rest API still in the process of downloading

I have the below code - after executing below code the client getting immediate response with blank zip file (with out having list of files) , however the StreamingResponseBody Still executing by ...
Dayananda's user avatar
0 votes
1 answer
34 views

MongoDB returns an empty list when run with Spring Boot Framework

When i run my spring boot application it returns an empty arraylist which i'm at alas on what is going on, because everything looks correct to me, here are my codes Checkout the images of the classes ...
john's user avatar
  • 1
1 vote
0 answers
48 views

Is using a wildcard (unbounded) instead of Object class a better approach?

I am working on a service has to forward the incoming requests to a destination service after performing some alterations on the object received in the request body and return the response received ...
Ashutosh Sharma's user avatar
1 vote
1 answer
327 views

Cannot invoke "org.springframework.http.ResponseEntity.getBody()" because "responseEntity" is null

In Mockito test cases, I m facing this response entity is null error which ideally should not be happening as I have mocked the response entity as well. My Code: Mockito.when(restTemplate.exchange(...
Hareni's user avatar
  • 15
0 votes
0 answers
19 views

Linking a PostMapping function in the Controller class to the Service class function

I have this function addBug(String title, String description, LocalDateTime created, LocalDateTime updated, ObjectId projectId) in my Service class: public Bug addBug(String title, String description, ...
dieudonne96's user avatar
0 votes
0 answers
681 views

Webclient to return ResponseEntity on error

I never worked with WebClient before, but I have to use it to send a Post request to an external url. After that I check the response status, and if it's 204 I'll continue with the process, but if the ...
Zoltan514's user avatar
0 votes
0 answers
171 views

How to return an InputStreamResource so it can readable from postman?

So I have a method @GetMapping( value = "/download/{fileId}", produces = { MediaType.APPLICATION_OCTET_STREAM_VALUE } ) public ResponseEntity<...
Lalisa Daniella's user avatar
0 votes
1 answer
962 views

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 ...
Michele Raso's user avatar
-1 votes
2 answers
429 views

How to handle a list of resources with ResponseEntity [closed]

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", "...
KJ0797's user avatar
  • 213
0 votes
0 answers
60 views

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") @...
kernel's user avatar
  • 420
0 votes
1 answer
385 views

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. ...
Suresh Vanalya's user avatar
0 votes
1 answer
347 views

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",&...
Geogrio's user avatar
  • 113
0 votes
0 answers
228 views

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

I'm trying to set the content length of my ResponseEntity<List> but the full list isn't returned in the response. I tried something like long contentLength = staticMethodGetsContentLength(...
adamB's user avatar
  • 43
2 votes
5 answers
592 views

Java get nested value from ResponseEntity without creating a pojo

I am trying to get a single nested value from a ResponseEntity but I am trying to do so without having to create a pojo for every possible item as this is a third party api response. Example response....
AylaWinters's user avatar
  • 1,241
0 votes
0 answers
517 views

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": {}, &...
TechNewPy's user avatar
1 vote
2 answers
2k views

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 `...
Wijdane KHATTAT's user avatar
0 votes
1 answer
132 views

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<Object> handleMethodArgumentNotValid(...
Yugandhar 's user avatar
0 votes
1 answer
622 views

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 = &...
Alyan Ahmed's user avatar
0 votes
0 answers
64 views

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

public ResponseEntity<Optional> getData(@RequestBody RequestModel requestModel) { try { List mango = new ArrayList(); mangoRepository.findByMangoTag( requestModel....
Chaitanya's user avatar
2 votes
1 answer
70 views

how return multivalued response

I'm currently writing a post API that gets a list of invoices number and then calls another API with resttamplate to obtain a pdf for every invoice number after that I concatenate all these pdf files ...
mohamed Saaad's user avatar
0 votes
1 answer
516 views

How to add support for Shallow ETag in ResponseEntity Spring Java

I understand that we can create the filter for Shallow E tag in spring. However, i am looking if there is an easier way to do it. I am using HttpEntity in my code for getting the response. The code ...
Charu Garg's user avatar
0 votes
0 answers
34 views

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"...
Aneesh Das Mazumder's user avatar
0 votes
1 answer
1k views

How to cache ResponseEntity<Resource> 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(...
Indra Neel's user avatar
0 votes
1 answer
176 views

MessageBodyWriter not found StreamingBodyResponse

I am trying to make StreamResponseBody work with sample hardcoded data. @POST @Path("filetypecsv") @Produces("text/plain") public ResponseEntity<StreamingResponseBody> ...
KudmiSubba's user avatar
0 votes
0 answers
260 views

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

Returning a response in SpringBoot project like this: @GetMapping("/users") public ResponseEntity<List<UserDto>> getUsers() { return ResponseEntity.ok(adminService.getUsers())...
İbrahim Demirci's user avatar
0 votes
1 answer
2k views

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

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},{...
tuniodu33's user avatar
1 vote
1 answer
2k views

Cannot infer type arguments for ResponseEntity

I am trying to return the response as string from my function using ResponseEntity but getting an error. I tried this: @GetMapping(value="/getuserip") public ResponseEntity<Object> ...
stan3098's user avatar
-1 votes
1 answer
998 views

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 ...
user404's user avatar
  • 1,952
2 votes
1 answer
3k views

What are the differences of Flux<T>, Flux<ResponseEntity<T>>, ResponseEntity<Flux<T>> as return type in Spring WebFlux?

I often see three different response return types: Flux<T>, ResponseEntity<Flux<T>>, and Flux<ResponseEntity<T>> in MVC style controllers using Spring WebFlux. The ...
Buck's user avatar
  • 471
0 votes
0 answers
1k views

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 ...
lu_lu's user avatar
  • 143
2 votes
4 answers
1k views

ResponseEntity do not return json response for Post Method

I'm having a hard time at getting response as JSON format while sending post method. My controller and response class is below. Also I used Jackson dependencies at my pom.xml and, I'm using @...
Özgür Akdeniz's user avatar
0 votes
1 answer
4k views

Open Pdf file on web page in Spring boot

@GetMapping(value = "/pdf",produces= MediaType.APPLICATION_PDF_VALUE) public ResponseEntity<InputStreamResource> getTermsConditions() throws Exception { String filePath = &...
javaUser's user avatar
3 votes
1 answer
1k views

What is the difference between returning void and ResponseEntity<Void> in Spring Boot RestController?

I wonder what the difference is between the return value of a Spring Boot RestController if void shall be returned? I can see do difference in a test in either way. It seems that even if I return void ...
du-it's user avatar
  • 2,681