From 9e4cf85af7af0a825e19aadf002af77618465281 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 29 Dec 2015 20:51:42 +0100 Subject: [PATCH] Add HTTP Status 451 UNavailable for legal reasons Issue: SPR-13632 --- .../java/org/springframework/http/HttpStatus.java | 11 +++++++++-- .../org/springframework/http/HttpStatusTests.java | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/HttpStatus.java b/spring-web/src/main/java/org/springframework/http/HttpStatus.java index d0f9b7c416a..2514c11699b 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpStatus.java +++ b/spring-web/src/main/java/org/springframework/http/HttpStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,13 @@ package org.springframework.http; /** - * Java 5 enumeration of HTTP status codes. + * Enumeration of HTTP status codes. * *

The HTTP status code series can be retrieved via {@link #series()}. * * @author Arjen Poutsma * @author Sebastien Deleuze + * @author Brian Clozel * @see HttpStatus.Series * @see HTTP Status Code Registry * @see List of HTTP status codes - Wikipedia @@ -321,6 +322,12 @@ public enum HttpStatus { * @see Additional HTTP Status Codes */ REQUEST_HEADER_FIELDS_TOO_LARGE(431, "Request Header Fields Too Large"), + /** + * {@code 451 Unavailable For Legal Reasons}. + * @see + * An HTTP Status Code to Report Legal Obstacles + */ + UNAVAILABLE_FOR_LEGAL_REASONS(451,"Unavailable For Legal Reasons"), // --- 5xx Server Error --- diff --git a/spring-web/src/test/java/org/springframework/http/HttpStatusTests.java b/spring-web/src/test/java/org/springframework/http/HttpStatusTests.java index 574f02bd9d3..3624ece763c 100644 --- a/spring-web/src/test/java/org/springframework/http/HttpStatusTests.java +++ b/spring-web/src/test/java/org/springframework/http/HttpStatusTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,6 +85,7 @@ public class HttpStatusTests { statusCodes.put(428, "PRECONDITION_REQUIRED"); statusCodes.put(429, "TOO_MANY_REQUESTS"); statusCodes.put(431, "REQUEST_HEADER_FIELDS_TOO_LARGE"); + statusCodes.put(451, "UNAVAILABLE_FOR_LEGAL_REASONS"); statusCodes.put(500, "INTERNAL_SERVER_ERROR"); statusCodes.put(501, "NOT_IMPLEMENTED");