Skip to content

Commit 2afe8e4

Browse files
committed
Fix #981. Add status codes from RFC 6585.
1 parent cddf142 commit 2afe8e4

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

api/src/main/java/jakarta/servlet/http/HttpServletResponse.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2025 Oracle and/or its affiliates and others.
2+
* Copyright (c) 1997, 2026 Oracle and/or its affiliates and others.
33
* All rights reserved.
44
* Copyright 2004 The Apache Software Foundation
55
*
@@ -745,6 +745,22 @@ default Supplier<Map<String, String>> getTrailerFields() {
745745
*/
746746
int SC_UPGRADE_REQUIRED = 426;
747747

748+
/**
749+
* Status code (428) indicating that the origin server requires this request to be conditional.
750+
*/
751+
int SC_PRECONDITION_REQUIRED = 428;
752+
753+
/**
754+
* Status code (429) indicating that the user has sent too many requests in a given amount of time ("rate limiting").
755+
*/
756+
int SC_TOO_MANY_REQUESTS = 429;
757+
758+
/**
759+
* Status code (431) indicating that the server is unwilling to process the request because its header fields are too
760+
* large.
761+
*/
762+
int SC_REQUEST_HEADER_FIELS_TOO_LARGE = 431;
763+
748764
/**
749765
* Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.
750766
*/
@@ -777,4 +793,9 @@ default Supplier<Map<String, String>> getTrailerFields() {
777793
* was used in the request message.
778794
*/
779795
int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
796+
797+
/**
798+
* Status code (511) indicating that the client needs to authenticate to gain network access.
799+
*/
800+
int SC_NETWORK_AUTHENTICATION_REQUIRED = 511;
780801
}

spec/src/main/asciidoc/servlet-spec-body.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ Generic Syntax
120120

121121
* RFC 6265 HTTP State Management Mechanism
122122

123+
* RFC 6585 Additional HTTP Status Codes
124+
123125
* RFC 7258 Pervasive Monitoring Is an Attack
124126

125127
* RFC 7541 HPACK: Header Compression for HTTP/2 (HPACK)
@@ -8588,6 +8590,9 @@ link:https://github.com/jakartaee/servlet/issues/867[Issue 867]::
85888590
When processing the `If-Modified-Since` header in `HttpServerlet.service()`,
85898591
invalid header values must be ignored as per RFC 9110.
85908592

8593+
link:https://github.com/jakartaee/servlet/issues/981[Issue 981]::
8594+
Add constants to `HttpServletResponse` for the status codes defined in RFC 6585.
8595+
85918596
link:https://github.com/jakartaee/servlet/issues/994[Issue 994]::
85928597
The value returned by `HttpServletRequest.getpathInfo()` does not contain path paremeter information.
85938598

0 commit comments

Comments
 (0)