Web-service using spring in which I have to get the params from the body of my post request? The content of the body is like:-
source=”mysource”
&json=
You will need these imports...
import javax.servlet.*;
import javax.servlet.http.*;
And, if you're using Maven, you'll also need this in the dependencies block of the pom.xml file in your project's base directory.
javax.servlet
javax.servlet-api
3.0.1
provided
Then the above-listed fix by Jason will work:
@ResponseBody
public ResponseEntity saveData(HttpServletRequest request,
HttpServletResponse response, Model model){
String jsonString = request.getParameter("json");
}