The article presents tips on how to fix 415 Unsupported Media Type error while working with AngularJS & SpringMVC web application when one tries to POST JSON data using $http service. The sole reason I wanted to write this blog is to help many of my friends who are most likely to hit this one when they work on posting JSON data to SpringMVC web controller using $http service.
Possible scenarios:
var dataObj = {
name1 : value1,
name2 : value2
}
Assertions:
public @ResponseBody String methodName( @RequestBody SomeDomainObject someObj ) {
}
Create a domain object with fields matching the JSON request parameters names. In this case, it would be name1, name2.
For sample code, take a look at following page:
http://hello-angularjs.appspot.com/angularjs-http-service-ajax-post-json-data-code-example
…
[adsenseyu1]
Last updated: 28th April, 2024 As a data scientist, understanding the nuances of various cost…
Last updated: 28th April, 2024 In this post, you will learn the concepts related to…
Last updated: 26th April, 2024 In this blog post, we will discuss the logistic regression…
Last updated: 22nd April, 2024 As data scientists, we navigate a sea of metrics to…
Last updated: 22nd April, 2024 This post will teach you about the gradient descent algorithm…
Last updated: 19th April, 2024 Among the terminologies used in training machine learning models, the…