How would servlet code from a service method (e.g.,
doPost()
) retrieve the value of the “User-Agent” header from the request? (Choose all that apply.)Which HTTP methods are used to show the client what the server is receiving? (Choose all that apply.)
Which method of
HttpServletResponse
is used to redirect an HTTP request to another URL?Which HTTP methods are NOT considered idempotent? (Choose all that apply.)
Given
req
is aHttpServletRequest
, which gets a binary input stream? (Choose all that apply.)How would you set a header named “CONTENT-LENGTH” in the
HttpServletResponse
object? (Choose all that apply.)Choose the servlet code fragment that gets a binary stream for writing an image or other binary type to the
HttpServletResponse
.Which methods are used by a servlet to handle form data from a client? (Choose all that apply.)
Which of the following methods are declared in
HttpServletRequest
as opposed to inServletRequest
? (Choose all that apply.)How should servlet developers handle the
HttpServlet
’sservice()
method when extendingHttpServlet
? (Choose all that apply.)
Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.