The "consumes" condition compares MediaType parameters

Closes gh-9257
This commit is contained in:
rstoyanchev
2022-05-11 14:54:00 +01:00
parent 4b0531b4aa
commit f0e23b66f3
11 changed files with 112 additions and 60 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 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.
@@ -169,7 +169,12 @@ public @interface RequestMapping {
* consumes = {"text/plain", "application/*"}
* consumes = MediaType.TEXT_PLAIN_VALUE
* </pre>
* Expressions can be negated by using the "!" operator, as in
* <p>If a declared media type contains a parameter, and if the
* {@code "content-type"} from the request also has that parameter, then
* the parameter values must match. Otherwise, if the media type from the
* request {@code "content-type"} does not contain the parameter, then the
* parameter is ignored for matching purposes.
* <p>Expressions can be negated by using the "!" operator, as in
* "!text/plain", which matches all requests with a {@code Content-Type}
* other than "text/plain".
* <p><b>Supported at the type level as well as at the method level!</b>
@@ -194,7 +199,7 @@ public @interface RequestMapping {
* </pre>
* <p>If a declared media type contains a parameter (e.g. "charset=UTF-8",
* "type=feed", "type=entry") and if a compatible media type from the request
* has that parameter too, then the parameter values must match. Otherwise
* has that parameter too, then the parameter values must match. Otherwise,
* if the media type from the request does not contain the parameter, it is
* assumed the client accepts any value.
* <p>Expressions can be negated by using the "!" operator, as in "!text/plain",