0

Im currently trying to figure out what process to follow in terms of posting data from my browser using JavaScript to a Java application.

JavaScript Post function

 xhr = new XMLHttpRequest();
 var url = "http://localhost:9200/test/mytest";
 xhr.open("POST", url, true);
 xhr.setRequestHeader("Content-type", "application/json");
 var data = JSON.stringify({"test" : testdata123});
 xhr.send(data);

I would like to consume the above Json data in a java application using rest. How do i go about setting this up?

adz
  • 91
  • 10

1 Answers1

0

Seems like a duplicate of How to consume json parameter in java restful service

As per JSR 311, you may use @Consumes annotation accepting MIME type of application/json to consume the data in your java application.

Community
  • 1
  • 1