angularJs $http. cannot revice params from request -


angularjs code:

$http({     method: 'post',     url:'/hello/rest/user/test',     data: {user: 'aaaaa'} }); 

server code:

@post @path("/test") public response merge(@context httpservletrequest request) {     system.out.println(request.getparameter("user"));     if (request.getparameter("user") == null) {         return response.status(status.bad_request).build();     }     return response.ok().build(); } 

request.getparameter("user") null. cannot revice parameter way.

if want use request parameter, need pass data

$http.post('/hello/rest/user/test', {     user : 'aaaaa'     }, {         headers : {             "content-type" : 'application/x-www-form-urlencoded;charset=utf-8'         },         transformrequest : [function(data) {             return angular.isobject(data)                     ? jquery.param(data)                     : data;         }]     }); 

also read this question


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -