samisnotinsane / qmsalsabooking

Class booking web app built on Spring.
https://qmsalsabooking.herokuapp.com
GNU General Public License v3.0
0 stars 0 forks source link

HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported #4

Closed samisnotinsane closed 6 years ago

samisnotinsane commented 6 years ago

The above exception occurs when 'Save' is clicked from add lesson form. In addition, an HTTP 415 is returned to client.

samisnotinsane commented 6 years ago

A Spring forum page (JSON HttpMediaTypeNotSupportedException) post suggests that objects must be serializable and deserializable to get rid of this error.

samisnotinsane commented 6 years ago

A Spring forum page (JSON HttpMediaTypeNotSupportedException) post suggests that objects must be serializable and deserializable to get rid of this error.

The problem in the above thread is related to submitting a JSON whereas this bug is related to an http form. This link may be more relevant.

samisnotinsane commented 6 years ago

A Spring forum page (JSON HttpMediaTypeNotSupportedException) post suggests that objects must be serializable and deserializable to get rid of this error.

The problem in the above thread is related to submitting a JSON whereas this bug is related to an http form. This link may be more relevant.

Removing @RequestBody annotation from the following method in LessonController fixed the issue.

public void create(@RequestBody Lesson lesson) {
        lessonService.save(lesson);
}