title: Jersey default media type if not Accept header is present
body: <p>In Jersey User Guide i read the following:</p>
  
  <pre><code>@GET
  @Produces({"application/xml", "application/json"})
  public String doGetAsXmlOrJson() {
      ...
  }
  
  If both are equally acceptable then the former will be chosen because it occurs first.
  </code></pre>
  
  <p>However in my RESTful service (note that JSON media type occurs first):</p>
  
  <pre><code>@GET
  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  public User getUser(@PathParam("id") int id) {
      User user = userDao.getUserById(id);
      return user;
  }
  </code></pre>
  
  <p>A request like: <strong>curl -v -X GET <code>http://localhost:8080/myapp/users/2</code></strong>, returns an XML response. If the request specifies Accept header like json or xml all is ok.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>curl --trace - -X GET http://localhost:8080/myapp/users/2
  == Info: Adding handle: conn: 0xc2ad68
  == Info: Adding handle: send: 0
  == Info: Adding handle: recv: 0
  == Info: Curl_addHandleToPipeline: length: 1
  == Info: - Conn 0 (0xc2ad68) send_pipe: 1, recv_pipe: 0
  == Info: About to connect() to localhost port 8080 (#0)
  == Info:   Trying 127.0.0.1...
  == Info: Connected to localhost (127.0.0.1) port 8080 (#0)
  =&gt; Send header, 97 bytes (0x61)
  GET /myapp/users/2 HTTP/1.1..User-Agent: curl/7.31.0..Hostlocalhost:8080..Accept: */*....
  &lt;= Recv header, 17 bytes (0x11)
  HTTP/1.1 200 OK..
  == Info: Server Apache-Coyote/1.1 is not blacklisted
  &lt;= Recv header, 27 bytes (0x1b)
  Server: Apache-Coyote/1.1..
  &lt;= Recv header, 31 bytes (0x1f)
  Content-Type: application/xml..
  &lt;= Recv header, 21 bytes (0x15)
  Content-Length:234..
  &lt;= Recv header, 37 bytes (0x25)
  Date: Sat, 07 Jun 2014 15:26:17GMT..
  &lt;= Recv header, 2 bytes (0x2)
  ..
  &lt;= Recv data, 234 bytes (0xea)
  &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;user id="2"&gt;&lt;name&gt;JOHN&lt;/name&gt;&lt;surname&gt;DOE&lt;/surname&gt;&lt;heigth&gt;172.5&lt;/heigth&gt;&lt;weigth&gt;70.5&lt;/weigth&gt;&lt;/user&gt;
  &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;user id="2"&gt;&lt;name&gt;JOHN&lt;/name&gt;&lt;surname&gt;DOE&lt;/surname&gt;&lt;heigth&gt;172.5&lt;/heigth&gt;&lt;weigth&gt;70.5&lt;/weigth&gt;&lt;/user&gt;
  == Info: Connection #0 to host localhost left intact
  </code></pre>
  
  <p><strong>Question:</strong> Why if not Accept header is present (*/<em>*</em>) use xml like media type?</p>
  
  <p>Thanks in advance!</p>