google / guava

Google core libraries for Java
Apache License 2.0
50.14k stars 10.89k forks source link

Add HTTP status codes #927

Open gissuebot opened 9 years ago

gissuebot commented 9 years ago

Original issue created by electrum on 2012-03-09 at 07:58 PM


The new HttpHeaders and MediaType classes are great! Can we get a similar HttpStatusCodes class? The JAX-RS Response.Status class could be a good starting point.

gissuebot commented 9 years ago

Original comment posted by kak@google.com on 2012-03-09 at 08:02 PM


We have something like this internally, but it'll need quite a bit of API-lovin' before we can even consider releasing it.


Status: Acknowledged Owner: kurt.kluever Labels: Package-Net, Type-Enhancement

gissuebot commented 9 years ago

Original comment posted by kevinb@google.com on 2012-05-30 at 07:45 PM


(No comment entered for this change.)


Labels: -Type-Enhancement, Type-Addition

gissuebot commented 9 years ago

Original comment posted by trejkaz on 2012-06-13 at 02:14 AM


I was just thinking that this would be nice and it looks like I'm not the only one. :)

gissuebot commented 9 years ago

Original comment posted by kevinb@google.com on 2012-06-22 at 06:16 PM


(No comment entered for this change.)


Status: Research

gissuebot commented 9 years ago

Original comment posted by alexande...@teamdev.com on 2013-08-25 at 09:09 AM


Yes, something like http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/http/HttpStatus.html would be nice.

EricEdens commented 9 years ago

I just bumped into this as well -- patches accepted?

kluever commented 9 years ago

The only issue is that we're not sure what the best design is: a file with a bunch of static int's? an enum? a full fledged class with static instances?

...or something completely different.

EricEdens commented 9 years ago

Supporting extensibility appears important:

HTTP status codes are extensible. HTTP applications are not required to understand the meaning of all registered status codes, though such understanding is obviously desirable.

Supporting extensibility could happen in creation and/or consumption. Twitter uses a few nonstandard 4xx codes to signal throttling and rate limiting errors. For example, the class should be able to do something useful when asked to interpret the nonstandard 429 from 'HTTP 429 Too Many Requests'.

sdavids commented 8 years ago

+1 for something like the Spring Enum mentioned above

SaketramDurbha commented 8 years ago

I think that a full fledged class with static instances would work best, since it also has support for nonstandard status codes such as 429 Too Many Requests. Also, this way, it would also be able to store the status code and the associated message.