Using the REST Tutorial, I’m trying to figure out how to create a second @GET method that also takes a parameter.
I’ve modified the CustomersResource file to include this method, but get the following error. The point here is not that I need another method to return the same data. But how to have a second @GET method that also uses a parameter like the default one in the sample.
@GET
@Path(“{anotherId}”)
public Customer getCustomerAnotherId(@PathParam(“anotherId”) int cId) {
return customerMap.get(cId);
}
Error when starting MyEclipse Tomcat Server:
SEVERE: A resource, class com.myeclipseide.ws.CustomersResource, has ambiguous sub-resource method for HTTP method GET, URI path template {id}, and output mime-type: application/xml. The problematic mime-type sets (as defined by @Produces annotation at Java methods getCustomer and getCustomerAnotherId) are [application/xml] and [application/xml]
Thank you