Why is "302" not defined in Response.Status from javax.ws.rs?

I am trying to use the Java library to check the universe of possible HTTP responses, rather than writing my own logic to check each response code individually.

I found the static class Response.Status in javax.ws.rs , which seems to be perfect for this purpose. Its documentation states:

For commonly used status codes defined by HTTP, see the HTTP / 1.1 documentation for a complete list.

If you visit the link to the HTTP / 1.1 documents referenced by the javax documentation, it is clear that you see the 302 response status code as valid.

However, the following call returns null , which means that "the corresponding status or zero does not correspond to the status" - this is clearly not true:

  Response.Status.fromStatusCode(302); 

And, of course, 302 / FOUND not included in the enumeration defined in this class.

Does anyone know why this is? Is this oversight in javax.ws.rs code - or was it intentional?

+4
source share
2 answers

In 2.0, the value of the Response.Status.FOUND (302) enumeration is added (along with several other response codes that were not available in earlier versions).

+4
source

There are many status codes in this listing. It is understood that they do not believe that 302 β€œcommon” enough to be included by name.

+1
source

Source: https://habr.com/ru/post/1498447/


All Articles