LuckyLuke
LuckyLuke

Reputation: 49077

Using ResponseEntity Spring MVC

I want to use the ResponseEntity without returning a body, only set status code and headers. The ResponseEntity is a generic class, do I need to specify the type in this case, and if, what should it be?

Upvotes: 2

Views: 3624

Answers (2)

Jukka
Jukka

Reputation: 4663

You can use return ResponseEntity<Void>

Upvotes: 4

NimChimpsky
NimChimpsky

Reputation: 47290

No you don't, just do something like this

ResponseEntity responseEntity  = new ResponseEntity(HttpStatus.BAD_REQUEST);

Upvotes: 5

Related Questions