Form via method PUT is not sending the data to a service restEasy

0

I'm sending a form via Ajax, my front is done in AngularJS. I capture the form information and send it to a service that is in Java RestReasy. But he arrives Nullo! Could someone help me?

In my controller it looks like this:

var req = {
         method: 'PUT',
         url: "api/empresa/"+appCtrl.userLogado.id,


         data: {empresa: empresa} ,

         headers: {'Content-Type':'application/x-www-form-urlencoded'}
        };


        $http(req).then(function (response) {

            iziToast.success({
                title: 'Sucesso!',
                message: 'Atualização realizada com sucesso!',

                onClose: function(){
                    $("#divload").hide();
                    $("#loader").hide();



                }


            });

        }, function (error) {

            iziToast.warning({
                message: 'Infelizmente não foi possível fazer a atualização',
                onClose: function() {

                    $("#divload").hide();
                    $("#loader").hide();
                    $("#login-box").show();
                    window.location.href = 'index.jsp';
                }

            });

        });

In my rest it looks like this:

@PUT
@Path("/{id}")
@PermitAll
public Response update(@PathParam("id") Long id ,@FormParam("empresa") String empresaJson){

[RESOLVED] In javascript I put JSON.stringify (JSON.parse ()) and solved the problem!

    
asked by anonymous 05.04.2017 / 15:13

0 answers