Skip to content

Commit 07278eb

Browse files
committed
Fix jakartaee#336 - expand list of supported HTTP status codes
Adds 308, 421, 422, 426
1 parent 1f2bffe commit 07278eb

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

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

+25
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,12 @@ default public Supplier<Map<String, String>> getTrailerFields() {
499499
*/
500500
public static final int SC_TEMPORARY_REDIRECT = 307;
501501

502+
/**
503+
* Status code (308) indicating that the requested resource resides permanently under a different URI. The new URI
504+
* <em>SHOULD</em> be given by the <code><em>Location</em></code> field in the response.
505+
*/
506+
public static final int SC_PERMANENT_REDIRECT = 308;
507+
502508
/**
503509
* Status code (400) indicating the request sent by the client was syntactically incorrect.
504510
*/
@@ -599,6 +605,25 @@ default public Supplier<Map<String, String>> getTrailerFields() {
599605
*/
600606
public static final int SC_EXPECTATION_FAILED = 417;
601607

608+
/**
609+
* Status code (421) indicating that the server is unwilling or unable to produce an authoritative response for the
610+
* target URI.
611+
*/
612+
public static final int SC_MISDIRECTED_REQUEST = 421;
613+
614+
/**
615+
* Status code (422) indicating that the server understands the content type of the request but is unable to process the
616+
* contained instructions.
617+
*/
618+
public static final int SC_UNPROCESSABLE_CONTENT = 422;
619+
620+
/**
621+
* Status code (426) indicating that the server refuses to perform the request using the current protocol but may be
622+
* willing to do so after the client upgrades to a different protocol. The server must include an appropriate
623+
* {@code Upgrade} header in the response.
624+
*/
625+
public static final int SC_UPGRADE_REQUIRED = 426;
626+
602627
/**
603628
* Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.
604629
*/

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

+4
Original file line numberDiff line numberDiff line change
@@ -8573,6 +8573,10 @@ Clarify the behaviour of `getDateHeader()` and `getIntHeader()` when multiple
85738573
headers with the same name are present in the `HttpServletRequest`. The expected
85748574
behaviour is aligned with `getHeader()`.
85758575

8576+
link:https://github.com/eclipse-ee4j/servlet-api/issues/336[Issue 336]::
8577+
Add new constants to `HttpServletResponse` for the HTTP response codes 308, 421,
8578+
422 and 426.
8579+
85768580
link:https://github.com/eclipse-ee4j/servlet-api/issues/415[Issue 415]::
85778581
Add overloaded `setCharacterEncoding()` methods that support `Charset`.
85788582

0 commit comments

Comments
 (0)