I am implementing REST API endpoints using spring mvc. I am trying to send back a HTTP response with a cookie value. This is the equivalent of what I need
You can use Spring API for Cookie: org.springframework.http.HttpCookie:
HttpCookie cookie = ResponseCookie.from("heroku-nav-data", nav_data) .path("/") .build(); return ResponseEntity.ok() .header(HttpHeaders.SET_COOKIE, cookie.toString()) .body(id);