Update HttpStatus to align with RFC9110 where relevant
Affects: 6.1
The HttpStatus javadoc links to HTTP Status Code Registry, which in turn refers to RFC9110 (published in June 2022). However the detailed documentation for HttpStatus’s values still refer to RFC7231, which was obsoleted by the former.
Some statuses have been updated. In particular, statuses 421 & 422 which used to be part of WebDav are now part of this RFC. I didn’t check for all statuses or other usages in the documentation.
Other changes that I could spot looking at https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml are:
-
413:PAYLOAD_TOO_LARGEbecomesCONTENT_TOO_LARGEwith slight variations in wording around protocols that allow request termination instead of connection close -
421: newMISDIRECT_REQUEST(we do have a deprecated enum value for the WebDAV code) -
422:UNPROCESSABLE_ENTITYbecomesUNPROCESSABLE_CONTENT -
509:BANDWIDTH_LIMIT_EXCEEDEDseems to now be Unassigned -
510:NOT_EXTENDEDobsoleted (RFC2774 moved to Historic)
We discussed this as a team and we feel such a refresh would best be done after the 6.2.x timeframe, at a minimum. This would imply a full pass on HttpStatus to deprecate codes, introduce new ones and refresh the links in the javadocs.
@simonbasle It’s the first time I hear about Spring 7, wouldn’t it make sense to already deprecate those which should be, so that you can change them in 7? I guess 7 is still far away, isn’t it?
Also wouldn’t it be possible to add the new ones already if they don’t clash with anything, so that users don’t have to wait for 7?
(I agree this is a nice to have for now since raw status codes can be used too, but on the other hand RFC 9110 is already 2 years old)
yes, sorry, I should have said "after the 6.2.x timeframe, at a minimum". In the meantime, I'd recommend using the raw codes or HttpStatusCode.valueOf(int) as a way of dealing with both known and unknown codes.
An issue can't be both an enhancement and a documentation so I've removed the former. @simonbasle can you please rephrase the title to properly describe the enhancement? Thanks!
Hi @snicoll @simonbasle @bclozel! Can I help with this? Here is my step-by-step plan:
- Compare all HTTP status codes in HttpStatus with the current RFC 9110 and identify which ones need updates.
- Add the new status codes mentioned in the updated RFC to ensure support is up-to-date.
- Mark deprecated statuses accordingly to inform users about the potential future changes.
- Update all Javadoc links to reference the current RFC 9110.
Let me know if my assistance would be useful or if there are any specific areas I should focus on! Thanks!
@simonbasle with the arrival of Spring Framework 7, is this still considered?
I see it has the 7.0.x Milestone, but we are already at 7.0.0-M3 now, so I don’t know if it can still get in. Doing this as part of that major release would be nice though (although I guess the new statuses could probably be backported?).
@DidierLoiseau it is in the milestone so we are still considering it. 7.0 is scheduled for November.