On p. 222 of Head First
Servlet, only HttpServletRequest can have getContextPath () (the request URI that indicates the context).
According to p.198,
a session is an object used to maintain conversational state with a client
.
Why HttpSession does not have this method ?