title: Multiple GET under a single resource: REST API
body: <p>I'm trying to create two GET requests which are linked with each other, that is, one is a child of the other. Please have a look at the below code:</p>
  
  <pre><code>@GET
  @QueryParam("{customerId}")
    public List&lt;customerModel&gt; getCustomers(@QueryParam("customerId") Long customerId) {
  if (customerId== null || customerId== 0)
    throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("400: customerId cannot be null!").build());
  try {
     ......
     ......
    return findCustomer(customerId); 
  } catch (Exception e) {
    log.error("Exception occurred when fetching the master detail customerId:" + customerId+", error :"+e.getMessage(), e);
    throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity("......").build());
  }
    }
  
  @GET
  @Path("{customerId}/moreInfo")
    public List&lt;customerInfoModel&gt; getCustomerInfo(@PathParam("customerId") Long customerId) {
      if (customerId== null || customerId== 0)
        throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("customerId cannot be null").build());
  try {
    .....
    .....
    return getCustomerInfo(customerId);
  } catch (Exception e) {
    log.error("Exception occurred when fetching the customer detail customerId:" + e.getMessage(), e);
    throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity("....").build());
  }
    }
  </code></pre>
  
  <p>If we notice, both of the GET calls are doing the same initial and logging work. The only difference is the method calls. Is there a way to write the same code only calling different function depending on the path?</p>