Questions tagged [response-entity]
35 questions
2
votes
1 answer
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 to one file and return this file as a response,…

mohamed Saaad
- 23
- 3
2
votes
1 answer
What are the differences of Flux, Flux>, ResponseEntity> as return type in Spring WebFlux?
I often see three different response return types: Flux, ResponseEntity>, and Flux> in MVC style controllers using Spring WebFlux. The documentation explains the difference between ResponseEntity> and…

Buck
- 471
- 3
- 9
2
votes
4 answers
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 @RestController as Controller annotation.
…

Özgür Akdeniz
- 35
- 6
2
votes
1 answer
What is the difference between returning void and ResponseEntity 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 the HttpStatus.NO_CONTENT (204) is returned to…

du-it
- 2,561
- 8
- 42
- 80
1
vote
0 answers
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 from the service. There are only two types of…

Ashutosh Sharma
- 11
- 3
1
vote
1 answer
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(ArgumentMatchers.anyString(),…

Hareni
- 15
- 4
1
vote
5 answers
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.getBody() as it appears in Postman:
{
…

AylaWinters
- 1,121
- 2
- 7
- 24
1
vote
1 answer
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 looks like this
return ResponseEntity.ok()
…

Charu Garg
- 11
- 1
1
vote
1 answer
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

stan3098
- 31
- 5
0
votes
0 answers
Rest Spring boot converts a response with duplicate object to id of that object
I write a rest spring boot that return List

Fahimeh Golzari
- 1
- 2
0
votes
0 answers
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 reading file by file and writing into output stream -…

Dayananda
- 17
- 9
0
votes
1 answer
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 below
Movie Class
From the movie class you can…

john
- 1
- 2
0
votes
0 answers
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, LocalDateTime created, LocalDateTime updated,
…
0
votes
0 answers
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 status is some errorcode I should send back the…

Zoltan514
- 1
- 1
0
votes
0 answers
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 download(@Valid @PathVariable(value = "fileId") String…