title: spring http request mapping single uri with different request parameters to different method is good practice or bad practice
body: <p>My question is I need to implement rest api to search Students bases on its attributes
  below are my urls.</p>
  
  <pre>
  
      http/my system/vo1/students/search?firstname=ABC&responseType=summary
      http/my system/vo1/students/search?age=ABC&responseType=summary
      http/my system/vo1/students/search?id=ABC& responseType =summary
      http/my system/vo1/students/search?mobile=ABC& responseType =summary
      http/my system/vo1/students/search?lastname=ABC& responseType =summary
      http/my system/vo1/students/search?education=ABC& responseType=summary
      http/my system/vo1/students/search?working=ABC& responseType =summary
      http/my system/vo1/students/search? responseType =summary
  
  </pre>
  
  <p>responseType can be summary,hierarchy or can more types will be added in feature.</p>
  
  <p>So i have single URI "/my system/vo1/students/search?" with different parameters
  and user will send max two optional parameters and min is one is mandatory that is responseType</p>
  
  <p>in spring we can map single uri with different request parameters to different method as shown below</p>
  
  <pre><code>@RequestMapping(value = “my system/vo1/students/search", method = RequestMethod.GET)
          @ResponseBody
          public Students  searchStudentByName(
                  @RequestParam(value = “name",required = true) String name,
                  @RequestParam(value = “ responseType", required = true) String responseType)
      {
              //do student fetching works
      }
  
      @RequestMapping(value = “my system/vo1/students/search", method = RequestMethod.GET)
          @ResponseBody
          public Students  searchStudentByAge(
                  @RequestParam(value = “age",required = true) int age,
                  @RequestParam(value = “ responseType", required = true) String responseType)
      {
              //do student fetching works
      }
  </code></pre>
  
  <p>and so on .. we can write 9 different methods for this . </p>
  
  <p>one  more way is to do it create only one method.</p>
  
  <pre><code> @RequestMapping(value = “my system/vo1/students/search", method = RequestMethod.GET)
          @ResponseBody
          public Students  searchStudentByAge(
                  @RequestParam(value = “firstname",required = true) String age,
                  @RequestParam(value = “age",required = false) int age,
                  @RequestParam(value = “lastname",required = false) String lastname,
                  @RequestParam(value = “working",required = false) String working,
               //add more for each field that will be present in url...........
                  @RequestParam(value = “ responseType", required = true) String responseType)
      {
              //do student fetching works
      }
  </code></pre>
  
  <p>In second approach we can write separate validator to validate the input request.</p>
  
  <p>I have below Questions</p>
  
  <ol>
  <li>which approach is best (considering best design principals and practices)</li>
  <li>why it is best approach</li>
  <li>what is best object oriented design for such problem</li>
  </ol>