Besides parameters, what else can I get from a Request object?
The ServletRequest and HttpServletRequest interfaces have a ton of methods you can call, but you don’t need to memorize them all. On your own, you really should look at the full API for javax.servlet. ServletRequest and javax.servlet.http.HttpServletRequest, but here we’ll look at only the methods you’re most likely to use in your work (and which might also show up on the exam).
In the real world, you’ll be lucky (or unlucky, depending on your perspective), to use more than 15% of the request API. Don’t worry if you aren’t clear about how or why you’d use each of these; we’ll see more details on some of them (especially cookies) later in the book.

The client’s platform and browser info
String client = request.getHeader("User-Agent");The cookies associated with this request
Cookie[] cookies = request.getCookies();The session associated with this client
HttpSession session = request.getSession();The HTTP Method of the request
String theMethod = request.getMethod();An input stream from the request
ServletInputStream input = getInputStream();Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access