I have angular code
app.controller('add', function ($scope, $http) {
    $scope.add = function() {
        $scope.msg = "no connect";
        var data = {name:'soso',description:'buba',method:'POST'};
        $http.post(host + "/add-component",data)
            .then(function (response) {
                $scope.msg = response.data;
            });
    }
});
in my servlet, I want to catch it
resp.setContentType("application/json; charset = utf8");
String name = req.getParameter("name");
String description = req.getParameter("description");
but my name and description both = null;
 
     
     
    
Map params = new HashMap<>();
        String[] body = req.getReader().lines().collect(Collectors.joining()).split("\"");
        for (int i = 1; i < body.length; i += 4) {
            params.put(body[i], body[i + 2]);
        }
        name = params.get("name");  – Mihail Kolomiets Aug 25 '18 at 11:43