Below I leave the method as follows:
JAVA:
@POST
@Path("/aprovarCompra")
@Consumes("multipart/form-data")
public void aprovarCompra(@FormParam("nrCompra") Long nrCompra,
@FormParam("usuario") String usuario) {
//aqui faco as validacoes conecto ao banco e aprovo a compra
}
The front end is in nodeJS (which I know almost nothing about, and the company has chosen to do this)
The code I have on the front end is as follows:
$('#aprovar').click(function(){
$.ajax({
type: "POST",
url:"10.0.2.15:7001/ws/resources/Compra/aprovarCompra",
contentType: "application/x-www-form-urlencoded",
data:'nrCompra=12345&usuario=usuarioMaster',
success: function (data) {
alert(data);
},
error:function (){
alert("error ao aprovar a Compra: "+nrCompra);
}
});
});