Close
« Tutorial

@CookieValue MCQ

0/13
0 ✓
0 ✗

1. Which Spring annotation is used to read the value of an HTTP cookie into a handler method parameter?

2. Where can the @CookieValue annotation be used?

3. In @CookieValue, which attribute is an alias of the value attribute?

4. A handler method uses @CookieValue with only the cookie name. The cookie is missing from the request. What happens by default?

5. Which @CookieValue attribute gives a fallback value to use when the cookie is not found?

6. What does Spring do when the parameter marked with @CookieValue is not a String, for example an int?

7. Which object do you use to send a cookie to the browser with the standard Servlet API?

8. When you set the max age of a Servlet Cookie with setMaxAge, in which unit is the value given?

9. Which method of HttpServletRequest returns the cookies sent by the browser?

10. What does request.getCookies() return when the request has no cookies?

11. What is the WebUtils#getCookie(request, name) helper method used for?

12. Which Spring class (available since Spring 5) lets you build a cookie with a fluent API to write it to the response?

13. How do you send a ResponseCookie to the browser?

14. Besides @CookieValue, how else can a handler method read cookie values?

15. What does the HttpOnly cookie attribute do?

16. What does the Secure cookie attribute do?

17. What does the SameSite cookie attribute control?

18. What does SameSite=Strict mean?

19. What does SameSite=Lax mean?

20. Which extra attribute must be set when you use SameSite=None?

Join