How to set HTTP response HEADERS in @RestController?
The HTTP response headers are very important. It is so, because the HEADERS values can inform to the HTTP client definitions about how to receive and interpret the received data. It include important fields, such as: · SET-COOKIE: · CONTENT-TYPE: · Content-Language : · RESPONSE-CODE: · Accept-Language : · Access-Control-Allow-Methods : · Etc; You can see a list here: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields Using Spring boot and its @RestController , although there are a few annotations and attributes (ex. @CrossOrigem, produces, etc.) that assists in the definition of how HTTP HEADERS have to be produced, it is possible to generate that with more fine control using the HttpHeaders class. ...