SPR-7354 - Added equivalent of JAX-RS @Consumes to Spring MVC

This commit is contained in:
Arjen Poutsma
2011-05-10 09:23:00 +00:00
parent 7f247a6b27
commit 71aae405d5
21 changed files with 1031 additions and 792 deletions

View File

@@ -153,7 +153,7 @@ import java.lang.annotation.Target;
* converters}.
* <li>A {@link org.springframework.http.HttpEntity HttpEntity&lt;?&gt;} or
* {@link org.springframework.http.ResponseEntity ResponseEntity&lt;?&gt;} object
* to access to the Servlet reponse HTTP headers and contents. The entity body will
* to access to the Servlet response HTTP headers and contents. The entity body will
* be converted to the response stream using
* {@linkplain org.springframework.http.converter.HttpMessageConverter message
* converters}.
@@ -297,4 +297,18 @@ public @interface RequestMapping {
*/
String[] headers() default {};
/**
* The consumable media types of the mapped request, narrowing the primary mapping.
* <p>The format is a sequence of media types ("text/plain", "application/*),
* with a request only mapped if the {@code Content-Type} matches one of these media types.
* 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>
* When used at the type level, all method-level mappings override
* this consumes restriction.
* @see org.springframework.http.MediaType
* @see javax.servlet.http.HttpServletRequest#getContentType()
*/
String[] consumes() default "*/*";
}