1. Which HTTP methods can a web browser submit form data with by default?
Why: Browser forms can only submit data using GET or POST. Methods like PUT, PATCH and DELETE are mostly used by non-browser clients or by JavaScript.
2. Which type of client can send HTTP PUT, PATCH and DELETE requests?
Why: Non-browser clients (for example curl) can send PUT, PATCH and DELETE requests. A plain HTML form cannot.
3. According to the Servlet API, for which HTTP method must ServletRequest.getParameter*() support form field access?
Why: The Servlet API requires form field access through getParameter*() methods only for HTTP POST. This is why PUT form data needs extra handling.
4. Why is form data in a PUT request not available through getParameter() by default?
Why: The Servlet API only guarantees getParameter*() support for form fields in POST requests. A PUT request body is not read as form parameters unless something helps.
5. What is the purpose of FormContentFilter in Spring?
Why:FormContentFilter reads form data from the body of PUT, PATCH and DELETE requests and wraps the request so the data can be read with getParameter*().
6. Which content type must a PUT request have for FormContentFilter to read its form data?
Why:FormContentFilter works with requests that have the content type application/x-www-form-urlencoded.
7. Which HTTP methods does FormContentFilter handle?
Why:FormContentFilter intercepts PUT, PATCH and DELETE requests, because the Servlet API already handles form data for POST.
8. Which Spring annotation maps a controller method to HTTP PUT requests?
Why:@PutMapping is the shortcut annotation for mapping HTTP PUT requests to a handler method.
9. Which method parameter type can be used with @RequestBody to read PUT form data as key and value pairs?
Why: A MultiValueMap<String, String> with @RequestBody lets you read form fields from the request body as key and value pairs.
10. Since which Spring version is FormContentFilter available?
Why:FormContentFilter has been available since Spring 5.1.
11. Which filter was used for PUT form data before FormContentFilter was introduced?
Why:HttpPutFormContentFilter was used before Spring 5.1. It was deprecated in favor of FormContentFilter.
12. What happened to HttpPutFormContentFilter in Spring 5.1?
Why: In Spring 5.1, HttpPutFormContentFilter was deprecated and replaced by FormContentFilter, which also supports PATCH and DELETE.
13. In which Spring module is FormContentFilter provided?
Why:FormContentFilter is provided by the spring-web module.
14. A controller handles a PUT request and needs the form values from the body. What is one way to read them in Spring MVC?
Why: A MultiValueMap parameter marked with @RequestBody receives the form fields sent in the PUT request body.
15. How can a PUT request be sent from a web page without using a normal form submit?
Why: A browser form cannot send PUT directly, but JavaScript (for example an AJAX call) can send PUT requests.