title: JAX-RS/Rest: Set a parameter multiple times, or use a single comma-delimited parameter?
body: <p>I read that the HTTP way to pass an array in a request is to set a parameter multiple times:</p>
  
  <pre><code>1) GET /users?orderBy=last_name&amp;orderBy=first_name
  </code></pre>
  
  <p>However, I've also seen the comma-delimited parameter (and I feel this is "cleaner"):</p>
  
  <pre><code>2) GET /users?orderBy=last_name,first_name
  </code></pre>
  
  <p>I want to implement multi-sorting (ordering users by last_name, then duplicate last_names are ordered by first_name). Code-wise, this is easy (Google's Guava libraries to the rescue), but how should I expose this? Does the first way even preserve the order of the fields (sort by last_name, then by first_name)?</p>
  
  <p>Spring will magically convert a parameter into a String[] array, if it is set multiple times in the request:</p>
  
  <pre><code>... @RequestParam("orderBy") String[] orderBy ... becomes ["last_name","first_name"]
  </code></pre>
  
  <p>This leads me to believe the first way is considered best-practice, although I like the second way...</p>