public class ApiResponse {
long timestamp;
int status;
String error;
String message;
String path;
public ApiResponse(HttpStatus status, String message) {
super();
this.status = status.value();
this.message = message;
}
}
I have this class and what i want to do is set response status based on status value of ApiResponse object
return new ApiResponse(HttpStatus.CREATED, "Success");
I want response status to be 201.
Is something like this possible?
I know there is ResponseEntity class but i want to handle it without using this class.