I'm using the default JEE7 REST application on Netbeans. The REST method that I'm trying to call is:
@GET
@Path("{id}")
@Produces({"application/xml", "application/json"})
public Customer find(@PathParam("id") Integer id) {
return super.find(id);
}
I can successfully get a list of all customers. However, when I get the customer ID on the client side with angular, it generates this URL:
http://localhost:8080/mavenproject2/customers?0=1
(when I passed the ID of 1) The addition of "?" and the index added "0=" makes the call fail.
http://localhost:8080/mavenproject2/customers/1 works
My service looks like this:
customerServices.factory('customerById', function ($resource) {
return $resource('http://localhost:8080/mavenproject2/customers/:id', {id: "@id"}, {
query: {method: 'GET', isArray: true}
});
})
and my controller looks like this:
.controller('customerDetailsController', function ($scope, $routeParams, customerById) {
$scope.customer = customerById.query($routeParams.customerId);
});
Assistance will be greatly appreciated.