I am implementing a java program that interfaces with Neo4j graph db via rest. Each request to the database results in an http status code like 200, 201, 401 and the like.
For my program some response codes are ok, like 200, 201 or 202 while, quite obviously, some others are NOT ok, like 401 404 and the like.
What I want to do, and actually am trying to do, is this: Use some sort of enum with Status Code (int), Status Text (as in HttpStatus) and a custom field with either OK (the response is ok for me) or NOK (the response is not ok for me).
My problem is that I have no Idea, how to traverse from the response code from REST (being the int 200) over SC_OK from HttpStatus to OK from my enum.
this obviously will not work:
int status = HttpStatus.SC_NO_CONTENT;
String StatusText = HttpStatus.getStatusText(status);
String OkOrNotOk = HttpStatusCodes.StatusText.getValue();
Can someone give me a hint?
Thanks in advance,
Chris