diff --git a/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java b/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java index 2b2cd16fcf..d6e81939a0 100644 --- a/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java +++ b/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -309,8 +309,8 @@ public abstract class MimeTypeUtils { *
audio/basic == text/html
audio/basic == * audio/wave
* @param mimeTypes the list of mime types to be sorted - * @see HTTP 1.1, section - * 14.1 + * @see HTTP 1.1: Semantics + * and Content, section 5.3.2 */ public static void sortBySpecificity(List mimeTypes) { Assert.notNull(mimeTypes, "'mimeTypes' must not be null"); diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java b/spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java index aeb0c45d3d..c4c7f6ea60 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/result/StatusResultMatchers.java @@ -29,6 +29,7 @@ import org.springframework.test.web.servlet.ResultMatcher; * * @author Keesun Baik * @author Rossen Stoyanchev + * @author Sebastien Deleuze * @since 3.2 */ public class StatusResultMatchers { @@ -283,7 +284,7 @@ public class StatusResultMatchers { * Assert the response status code is {@code HttpStatus.MOVED_TEMPORARILY} (302). * @see #isFound() */ - @SuppressWarnings("deprecation") + @Deprecated public ResultMatcher isMovedTemporarily() { return matcher(HttpStatus.MOVED_TEMPORARILY); } @@ -304,7 +305,9 @@ public class StatusResultMatchers { /** * Assert the response status code is {@code HttpStatus.USE_PROXY} (305). + * @deprecated matching the deprecation of {@code HttpStatus.USE_PROXY} */ + @Deprecated public ResultMatcher isUseProxy() { return matcher(HttpStatus.USE_PROXY); } @@ -415,15 +418,37 @@ public class StatusResultMatchers { } /** - * Assert the response status code is {@code HttpStatus.REQUEST_ENTITY_TOO_LARGE} (413). + * Assert the response status code is {@code HttpStatus.PAYLOAD_TOO_LARGE} (413). + * @since 4.1 */ + public ResultMatcher isPayloadTooLarge() { + return matcher(HttpStatus.PAYLOAD_TOO_LARGE); + } + + /** + * Assert the response status code is {@code HttpStatus.REQUEST_ENTITY_TOO_LARGE} (413). + * @deprecated matching the deprecation of {@code HttpStatus.REQUEST_ENTITY_TOO_LARGE} + * @see #isPayloadTooLarge() + */ + @Deprecated public ResultMatcher isRequestEntityTooLarge() { return matcher(HttpStatus.REQUEST_ENTITY_TOO_LARGE); } /** * Assert the response status code is {@code HttpStatus.REQUEST_URI_TOO_LONG} (414). + * @since 4.1 */ + public ResultMatcher isUriTooLong() { + return matcher(HttpStatus.URI_TOO_LONG); + } + + /** + * Assert the response status code is {@code HttpStatus.REQUEST_URI_TOO_LONG} (414). + * @deprecated matching the deprecation of {@code HttpStatus.REQUEST_URI_TOO_LONG} + * @see #isUriTooLong() + */ + @Deprecated public ResultMatcher isRequestUriTooLong() { return matcher(HttpStatus.REQUEST_URI_TOO_LONG); } @@ -458,7 +483,7 @@ public class StatusResultMatchers { /** * Assert the response status code is {@code HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE} (419). - * @deprecated matching the deprecation of HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE + * @deprecated matching the deprecation of {@code HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE} */ @Deprecated public ResultMatcher isInsufficientSpaceOnResource() { @@ -467,7 +492,7 @@ public class StatusResultMatchers { /** * Assert the response status code is {@code HttpStatus.METHOD_FAILURE} (420). - * @deprecated matching the deprecation of HttpStatus.METHOD_FAILURE + * @deprecated matching the deprecation of {@code HttpStatus.METHOD_FAILURE} */ @Deprecated public ResultMatcher isMethodFailure() { @@ -476,7 +501,7 @@ public class StatusResultMatchers { /** * Assert the response status code is {@code HttpStatus.DESTINATION_LOCKED} (421). - * @deprecated matching the deprecation of HttpStatus.DESTINATION_LOCKED + * @deprecated matching the deprecation of {@code HttpStatus.DESTINATION_LOCKED} */ @Deprecated public ResultMatcher isDestinationLocked() { 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 752e2a789f..d0f9b7c416 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpStatus.java +++ b/spring-web/src/main/java/org/springframework/http/HttpStatus.java @@ -22,6 +22,7 @@ package org.springframework.http; *

The HTTP status code series can be retrieved via {@link #series()}. * * @author Arjen Poutsma + * @author Sebastien Deleuze * @see HttpStatus.Series * @see HTTP Status Code Registry * @see List of HTTP status codes - Wikipedia @@ -32,12 +33,12 @@ public enum HttpStatus { /** * {@code 100 Continue}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.2.1 */ CONTINUE(100, "Continue"), /** * {@code 101 Switching Protocols}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.2.2 */ SWITCHING_PROTOCOLS(101, "Switching Protocols"), /** @@ -56,37 +57,37 @@ public enum HttpStatus { /** * {@code 200 OK}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.3.1 */ OK(200, "OK"), /** * {@code 201 Created}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.3.2 */ CREATED(201, "Created"), /** * {@code 202 Accepted}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.3.3 */ ACCEPTED(202, "Accepted"), /** * {@code 203 Non-Authoritative Information}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.3.4 */ NON_AUTHORITATIVE_INFORMATION(203, "Non-Authoritative Information"), /** * {@code 204 No Content}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.3.5 */ NO_CONTENT(204, "No Content"), /** * {@code 205 Reset Content}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.3.6 */ RESET_CONTENT(205, "Reset Content"), /** * {@code 206 Partial Content}. - * @see HTTP/1.1 + * @see HTTP/1.1: Range Requests, section 4.1 */ PARTIAL_CONTENT(206, "Partial Content"), /** @@ -109,44 +110,46 @@ public enum HttpStatus { /** * {@code 300 Multiple Choices}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.4.1 */ MULTIPLE_CHOICES(300, "Multiple Choices"), /** * {@code 301 Moved Permanently}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.4.2 */ MOVED_PERMANENTLY(301, "Moved Permanently"), /** * {@code 302 Found}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.4.3 */ FOUND(302, "Found"), /** * {@code 302 Moved Temporarily}. - * @see HTTP/1.0 + * @see HTTP/1.0, section 9.3 * @deprecated In favor of {@link #FOUND} which will be returned from {@code HttpStatus.valueOf(302)} */ @Deprecated MOVED_TEMPORARILY(302, "Moved Temporarily"), /** * {@code 303 See Other}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.4.4 */ SEE_OTHER(303, "See Other"), /** * {@code 304 Not Modified}. - * @see HTTP/1.1 + * @see HTTP/1.1: Conditional Requests, section 4.1 */ NOT_MODIFIED(304, "Not Modified"), /** * {@code 305 Use Proxy}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.4.5 + * @deprecated due to security concerns regarding in-band configuration of a proxy */ + @Deprecated USE_PROXY(305, "Use Proxy"), /** * {@code 307 Temporary Redirect}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.4.7 */ TEMPORARY_REDIRECT(307, "Temporary Redirect"), /** @@ -159,92 +162,108 @@ public enum HttpStatus { /** * {@code 400 Bad Request}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.1 */ BAD_REQUEST(400, "Bad Request"), /** * {@code 401 Unauthorized}. - * @see HTTP/1.1 + * @see HTTP/1.1: Authentication, section 3.1 */ UNAUTHORIZED(401, "Unauthorized"), /** * {@code 402 Payment Required}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.2 */ PAYMENT_REQUIRED(402, "Payment Required"), /** * {@code 403 Forbidden}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.3 */ FORBIDDEN(403, "Forbidden"), /** * {@code 404 Not Found}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.4 */ NOT_FOUND(404, "Not Found"), /** * {@code 405 Method Not Allowed}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.5 */ METHOD_NOT_ALLOWED(405, "Method Not Allowed"), /** * {@code 406 Not Acceptable}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.6 */ NOT_ACCEPTABLE(406, "Not Acceptable"), /** * {@code 407 Proxy Authentication Required}. - * @see HTTP/1.1 + * @see HTTP/1.1: Authentication, section 3.2 */ PROXY_AUTHENTICATION_REQUIRED(407, "Proxy Authentication Required"), /** * {@code 408 Request Timeout}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.7 */ REQUEST_TIMEOUT(408, "Request Timeout"), /** * {@code 409 Conflict}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.8 */ CONFLICT(409, "Conflict"), /** * {@code 410 Gone}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.9 */ GONE(410, "Gone"), /** * {@code 411 Length Required}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.10 */ LENGTH_REQUIRED(411, "Length Required"), /** * {@code 412 Precondition failed}. - * @see HTTP/1.1 + * @see HTTP/1.1: Conditional Requests, section 4.2 */ PRECONDITION_FAILED(412, "Precondition Failed"), /** - * {@code 413 Request Entity Too Large}. - * @see HTTP/1.1 + * {@code 413 Payload Too Large}. + * @since 4.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.11 */ + PAYLOAD_TOO_LARGE(413, "Payload Too Large"), + /** + * {@code 413 Request Entity Too Large}. + * @see HTTP/1.1, section 10.4.14 + * @deprecated In favor of {@link #PAYLOAD_TOO_LARGE} which will be returned from {@code HttpStatus.valueOf(413)} + */ + @Deprecated REQUEST_ENTITY_TOO_LARGE(413, "Request Entity Too Large"), /** - * {@code 414 Request-URI Too Long}. - * @see HTTP/1.1 + * {@code 414 URI Too Long}. + * @since 4.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.12 */ + URI_TOO_LONG(414, "URI Too Long"), + /** + * {@code 414 Request-URI Too Long}. + * @see HTTP/1.1, section 10.4.15 + * @deprecated In favor of {@link #URI_TOO_LONG} which will be returned from {@code HttpStatus.valueOf(414)} + */ + @Deprecated REQUEST_URI_TOO_LONG(414, "Request-URI Too Long"), /** * {@code 415 Unsupported Media Type}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.13 */ UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"), /** * {@code 416 Requested Range Not Satisfiable}. - * @see HTTP/1.1 + * @see HTTP/1.1: Range Requests, section 4.4 */ REQUESTED_RANGE_NOT_SATISFIABLE(416, "Requested range not satisfiable"), /** * {@code 417 Expectation Failed}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.5.14 */ EXPECTATION_FAILED(417, "Expectation Failed"), /** @@ -255,15 +274,18 @@ public enum HttpStatus { /** * @deprecated See WebDAV Draft Changes */ - @Deprecated INSUFFICIENT_SPACE_ON_RESOURCE(419, "Insufficient Space On Resource"), + @Deprecated + INSUFFICIENT_SPACE_ON_RESOURCE(419, "Insufficient Space On Resource"), /** * @deprecated See WebDAV Draft Changes */ - @Deprecated METHOD_FAILURE(420, "Method Failure"), + @Deprecated + METHOD_FAILURE(420, "Method Failure"), /** * @deprecated See WebDAV Draft Changes */ - @Deprecated DESTINATION_LOCKED(421, "Destination Locked"), + @Deprecated + DESTINATION_LOCKED(421, "Destination Locked"), /** * {@code 422 Unprocessable Entity}. * @see WebDAV @@ -304,32 +326,32 @@ public enum HttpStatus { /** * {@code 500 Internal Server Error}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.6.1 */ INTERNAL_SERVER_ERROR(500, "Internal Server Error"), /** * {@code 501 Not Implemented}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.6.2 */ NOT_IMPLEMENTED(501, "Not Implemented"), /** * {@code 502 Bad Gateway}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.6.3 */ BAD_GATEWAY(502, "Bad Gateway"), /** * {@code 503 Service Unavailable}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.6.4 */ SERVICE_UNAVAILABLE(503, "Service Unavailable"), /** * {@code 504 Gateway Timeout}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.6.5 */ GATEWAY_TIMEOUT(504, "Gateway Timeout"), /** * {@code 505 HTTP Version Not Supported}. - * @see HTTP/1.1 + * @see HTTP/1.1: Semantics and Content, section 6.6.6 */ HTTP_VERSION_NOT_SUPPORTED(505, "HTTP Version not supported"), /** diff --git a/spring-web/src/main/java/org/springframework/http/MediaType.java b/spring-web/src/main/java/org/springframework/http/MediaType.java index 2aa8a6d01f..9ae41f23c2 100644 --- a/spring-web/src/main/java/org/springframework/http/MediaType.java +++ b/spring-web/src/main/java/org/springframework/http/MediaType.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -41,7 +41,8 @@ import org.springframework.util.comparator.CompoundComparator; * @author Juergen Hoeller * @author Rossen Stoyanchev * @since 3.0 - * @see HTTP 1.1, section 3.7 + * @see HTTP 1.1: Semantics + * and Content, section 3.1.1.1 */ public class MediaType extends MimeType implements Serializable { @@ -431,7 +432,8 @@ public class MediaType extends MimeType implements Serializable { *

audio/basic == text/html
*
audio/basic == audio/wave
* @param mediaTypes the list of media types to be sorted - * @see HTTP 1.1, section 14.1 + * @see HTTP 1.1: Semantics + * and Content, section 5.3.2 */ public static void sortBySpecificity(List mediaTypes) { Assert.notNull(mediaTypes, "'mediaTypes' must not be null"); diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutCallableProcessingInterceptor.java b/spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutCallableProcessingInterceptor.java index 1c8016eefc..67d3fdbaba 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutCallableProcessingInterceptor.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutCallableProcessingInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -27,7 +27,7 @@ import org.springframework.web.context.request.NativeWebRequest; * already committed. Registered at the end, after all other interceptors and * therefore invoked only if no other interceptor handles the timeout. * - *

Note that according to RFC 2616, a 503 without a 'Retry-After' header is + *

Note that according to RFC 7231, a 503 without a 'Retry-After' header is * interpreted as a 500 error and the client should not retry. Applications * can install their own interceptor to handle a timeout and add a 'Retry-After' * header if necessary. diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutDeferredResultProcessingInterceptor.java b/spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutDeferredResultProcessingInterceptor.java index 62c0a5fbb7..75e423f199 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutDeferredResultProcessingInterceptor.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/TimeoutDeferredResultProcessingInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -25,7 +25,7 @@ import org.springframework.web.context.request.NativeWebRequest; * already committed. Registered at the end, after all other interceptors and * therefore invoked only if no other interceptor handles the timeout. * - *

Note that according to RFC 2616, a 503 without a 'Retry-After' header is + *

Note that according to RFC 7231, a 503 without a 'Retry-After' header is * interpreted as a 500 error and the client should not retry. Applications * can install their own interceptor to handle a timeout and add a 'Retry-After' * header if necessary. 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 fee715e25a..574f02bd9d 100644 --- a/spring-web/src/test/java/org/springframework/http/HttpStatusTests.java +++ b/spring-web/src/test/java/org/springframework/http/HttpStatusTests.java @@ -69,8 +69,8 @@ public class HttpStatusTests { statusCodes.put(410, "GONE"); statusCodes.put(411, "LENGTH_REQUIRED"); statusCodes.put(412, "PRECONDITION_FAILED"); - statusCodes.put(413, "REQUEST_ENTITY_TOO_LARGE"); - statusCodes.put(414, "REQUEST_URI_TOO_LONG"); + statusCodes.put(413, "PAYLOAD_TOO_LARGE"); + statusCodes.put(414, "URI_TOO_LONG"); statusCodes.put(415, "UNSUPPORTED_MEDIA_TYPE"); statusCodes.put(416, "REQUESTED_RANGE_NOT_SATISFIABLE"); statusCodes.put(417, "EXPECTATION_FAILED"); @@ -115,7 +115,7 @@ public class HttpStatusTests { for (HttpStatus status : HttpStatus.values()) { int value = status.value(); - if (value == 302) { + if (value == 302 || value == 413 || value == 414) { continue; } assertTrue("Map has no value for [" + value + "]", statusCodes.containsKey(value)); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/EncodedResource.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/EncodedResource.java index 91c0a54228..04996ad4cd 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/EncodedResource.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/EncodedResource.java @@ -28,14 +28,16 @@ import org.springframework.core.io.Resource; * * @author Jeremy Grelle * @since 4.1 - * @see RFC2616 HTTP Content-Encoding + * @see HTTP/1.1: Semantics + * and Content, section 3.1.2.2 */ public interface EncodedResource extends Resource { /** * The content coding value, as defined in the IANA registry * @return the content encoding - * @see RFC 2616 Content codings + * @see HTTP/1.1: Semantics + * and Content, section 3.1.2.1 */ public String getContentEncoding(); diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/WebSocketExtension.java b/spring-websocket/src/main/java/org/springframework/web/socket/WebSocketExtension.java index 862de0a382..4ec0fe803b 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/WebSocketExtension.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/WebSocketExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -38,7 +38,7 @@ import org.springframework.util.StringUtils; * * *

WebSocket Extension HTTP headers may include parameters and follow - * RFC 2616 Section 4.2

+ * RFC 7230 section 3.2

* *

Note that the order of extensions in HTTP headers defines their order of execution, * e.g. extensions "foo, bar" will be executed as "bar(foo(message))".