I wrote a rest webservice and to avoid the error I got in my java code which is: The registered message body readers compatible with the MIME media type, I have to add to my $http.post a 'Content-Type': 'application/x-www-form-urlencoded' or 'Content-Type': 'application/json'. I am using Angularjs 1.3.5 and whenever I tried to add the headers {content-type.... }, I failed. What can I do exactly to solve my problem?
$scope.save = function(url,data) {
var data_stack = $scope.stack;
$http.post(url, data_stack)
.then(
function(response){
},
function(response){
});
}
<form ng-submit="save()">
<input ng-model="stack"></input>
<button type="submit">Save</button>
</form>