title: Rest | MIME types : acceptance order
body: <p>for class exposing resource "/hello":</p>
  
  <pre><code>@Path("/hello")
  public class Test {
  
  
      //-- produces MIME type text/plain
      @GET
      @Produces(MediaType.TEXT_PLAIN)
      public  String thankYouTxt(){
          System.out.println("thankYouTxt");
  
          return "thankYouTxt\n";
      }
  
      //-- consumes MIME type text/plain
      @GET
      @Consumes(MediaType.TEXT_PLAIN)
      public String thankYouInputTxt(){
          System.out.println("thankYouInputTxt");
          return "thankYouInputTxt";
  
      }
  
  
      //-- produces MIME type text/html
      @GET
      @Produces(MediaType.TEXT_HTML)
      public  String thankYouHTML(){
          System.out.println("thankYouHTML"); 
          return "thankYouTxtHTML";
      }
  
  
      //-- consumes MIME type text/html
      @GET
      @Consumes(MediaType.TEXT_HTML)
      public  void thankYouInputHTML(){
          System.out.println("thankYouInputHTML");
          //return "thankYouInputHTML";
      }
  
  
  
      //-- produces MIME type text/xml 
      @GET
      @Produces(MediaType.TEXT_XML)
      public  String thankYouXML(){
          System.out.println("thankYouXml");
          return "&lt;?xml version=\"1.0\"?&gt; &lt;message&gt;thankYouTxt&lt;/message&gt;";
      }
      //-- consumes MIME type text/xml    
      @GET
      @Consumes(MediaType.TEXT_XML)
      public String thankYouInputXML(){
          System.out.println("thankYouInputXML");
          return "thankYouInputXML";
      }
  
  
  
  }
  </code></pre>
  
  <p>on the <a href="http://docs.oracle.com/cd/E19776-01/820-4867/ghrpv/" rel="nofollow">Api docu</a> they state about the MIME acceptance order:</p>
  
  <blockquote>
    <p>If a resource class is capable of producing more that one MIME media
    type, the resource method chosen will correspond to the most
    acceptable media type as declared by the client. More specifically,
    the Accept header of the HTTP request declared what is most
    acceptable. For example if the Accept header is Accept: text/plain,
    the doGetAsPlainText method will be invoked. Alternatively if the
    Accept header is Accept: text/plain;q=0.9, text/html, which declares
    that the client can accept media types of text/plain and text/html,
    but prefers the latter, then the doGetAsHtml method will be invoked.</p>
  </blockquote>
  
  <p>who/what decides which MIME type (text/html) to consume rather than another one (text/html) ?</p>