Close
« Tutorial

Spring MVC - HTTP PUT with JSON Body MCQ

0/13
0 ✓
0 ✗

1. Which annotation maps an HTTP PUT request to a controller method?

2. Which annotation is used to bind the JSON body of a request to a Java object parameter?

3. Which Content-Type header value should a client send when the request body contains JSON?

4. What does Spring MVC use to convert a JSON request body into a Java object?

5. What must be present on the classpath so that Spring MVC can convert JSON to Java objects?

6. What does @PathVariable do in the handler method below?

@PutMapping("/{id}")
public String update(@PathVariable("id") long id,
                     @RequestBody Item item) {
    ...
}

7. What is an HTTP PUT request normally used for?

8. A controller method has @ResponseBody and returns a String. What happens to the returned text?

9. A handler method uses @RequestBody to read a JSON object. The client sends the JSON with Content-Type: text/plain. What is the most likely result?

10. A controller method is mapped with @PutMapping. A client sends a GET request to the same URL. What is the most likely response?

11. How can a web page send an HTTP PUT request with a JSON body?

12. When Spring converts a JSON body to a Java object, how are the JSON fields matched with the Java object?

13. Which annotation on a Java configuration class enables Spring MVC features such as the default message converters?

Join