i've been trying my hand on Angularjs + rest and when trying to get the data , i am getting the error - undefined 405 (Method Not Allowed)
main.js --
url:'http://abc.org/angularDemo/rest/demo/studentJson',
type:'GET'}).success(function (sampleData) {
alert("here ... "+sampleData);
$scope.setPagingData(sampleData,page,pageSize);
}).error(function () {
alert("Error getting users.");
});
@Path("/demo")
@XmlRootElement
public class AngularDataObj {
@GET
@Path("/studentJson")
@Produces(MediaType.APPLICATION_JSON)
public List<StudentObj> studentJson(){
List<StudentObj> list = new ArrayList<StudentObj>();
StudentObj obj = new StudentObj();
//Map<String,StudentObj> map = new HashMap<String,StudentObj>();
for(int i=0 ; i< 50; i++){
obj.setName("name"+i);
obj.setAge(20+i);
obj.setId(i);
obj.setLocation("location"+i);
list.add(obj);
//map.put(""+i, obj);
}
return list;
}
}
i am able to see the json object when i directly access this url - http://abc.org/angularDemo/rest/demo/studentJson