title: Some information about produces attribute inside @RequestMapping in Spring MVC
body: <p>in the Spring MVC Showcase example (dowlodable from STS dashboard) I have the following situation.</p>
  
  <p>In my view I have the following link:</p>
  
  <pre><code>        &lt;li&gt;
              &lt;a id="responseCharsetProduce" class="textLink" href="&lt;c:url value="/response/charset/produce" /&gt;"&gt;@ResponseBody (UTF-8 charset produced)&lt;/a&gt;
          &lt;/li&gt;
  </code></pre>
  
  <p>This link generate an HTTP Request towards the URL: <strong>"/response/charset/produce"</strong></p>
  
  <p>Ok, this HTTP Request is handleed by the following method of a controller class (my controller class is itself annotated with @RequestMapping(value="/response", method=RequestMethod.GET so this method handled this request):</p>
  
  <pre><code>@RequestMapping(value="/charset/produce", produces="text/plain;charset=UTF-8")
  public @ResponseBody String responseProducesConditionCharset() {
      return "\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\uff01 (\"Hello world!\" in Japanese)";
  }
  </code></pre>
  
  <p>My doubt is related to the <strong>produces</strong> element inside the @RequestMapping annotation...</p>
  
  <p>Reading here: <a href="http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/bind/annotation/RequestMapping.html" rel="nofollow">http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/bind/annotation/RequestMapping.html</a></p>
  
  <p>say that: <strong>String[] produces The producible media types of the mapped request, narrowing the primary mapping.</strong> so it seems that produces say only what media types is produced by the method...in my specific case say that the media type returned by the controller method is textual value...</p>
  
  <p>But reading elsewhere instead I found that the produces attribute excludes HTTP Request with Accepts header incompatible with the media type specified...</p>
  
  <p>So...what exactly do produces attribute inside @RequestMapping?</p>