Java REST call using angularjs with param value -
i trying make rest call in java using angularjs-
java code:-
@get @path("/getdata/{id}") @produces(mediatype.text_plain) public static string getdata(@pathparam("id") string id) { //operation }
angularjs rest call-
var response = $http.get('/projname/rest/get/getdata', {params: {id: id}});
but it's giving me exception-
org.jboss.resteasy.spi.notfoundexception: not find resource full path:
the error caused fact, you're trying access different endpoint. endpoint listens requests like:
projname/rest/get/getdata/{id} //e.g. projname/rest/get/getdata/1
but you're calling:
projname/rest/get/getdata?id={id} projname/rest/get/getdata?id=1
your code should be:
var response = $http.get('/projname/rest/get/getdata/' + id); @get @path("/getdata/{id}") @produces(mediatype.text_plain) public static string getdata(@pathparam("id") string id) { //operation }
Comments
Post a Comment