java - Error 405 Method Not Allowed error, when sending DELETE to server -
java - Error 405 Method Not Allowed error, when sending DELETE to server -
i next response when seek delete: 405 method not allowed. in logs there written allowed, delete isn't.
java:
@responsebody @requestmapping(method = requestmethod.delete, value = "/{id}") public void delete(@pathvariable string id) { speakerservice.delete(id); }
angularjs
app.factory('speakerresource', function ($resource) { homecoming $resource('rest/speaker/:speakerid', { speakerid: '@speakerid' }, { 'update': { method: 'put' } }, { 'delete': { method: 'delete', params: { 'id': 'speakerid' }} } ) });
speakerservice
this.delete = function (id, callback) { speakerresource.delete({ speakerid: id }, function () { callback(); }); }
i not know finish code, , not expert in angularjs, looks want send delete request url <hopefullysomething>/{id}
(path variable). looks send delete request url parameter id <hopefullysomething>?id={id}
(request parameter).
this question , answers explain difference between path variable , request parameters bit more @requestparam vs @pathvariable
java angularjs spring rest crud
Comments
Post a Comment