Lernkarten

Karten 135 Karten
Lernende 1 Lernende
Sprache English
Stufe Berufslehre
Erstellt / Aktualisiert 31.08.2017 / 26.10.2017
Lizenzierung Keine Angabe     (Oracle)
Weblink
Einbinden
0 Exakte Antworten 1 Text Antworten 134 Multiple Choice Antworten
Fenster schliessen

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.)

String userAgent = request.getParameter(“User-Agent”);

String userAgent = request.getHeader(“User-Agent”);

String userAgent = request.getRequestHeader(“Mozilla”);

String userAgent = getServletContext().getInitParameter(“User-Agent”);

Fenster schliessen

 Which HTTP methods are used to show the client what the server is receiving?
(Choose all that apply.)

GET

PUT

TRACE

RETURN

OPTIONS

Fenster schliessen

Which method of HttpServletResponse is used to redirect an HTTP request to another URL?

sendURL()

redirectURL()

redirectHttp()

sendRedirect()

getRequestDispatcher()

Fenster schliessen

Which HTTP methods are NOT considered idempotent?
(Choose all that apply.) 

GET

POST

HEAD

PUT

Fenster schliessen

Given req is a HttpServletRequest, which gets a binary input stream?
(Choose all that apply.) 

BinaryInputStream s = req.getInputStream();

ServletInputStream s = req.getInputStream();

BinaryInputStream s = req.getBinaryStream();

ServletInputStream s = req.getBinaryStream();

Fenster schliessen

How would you set a header named “CONTENT-LENGTH” in the HttpServletResponse object?
(Choose all that apply.) 

response.setHeader(CONTENT-LENGTH,”1024”);

response.setHeader(“CONTENT-LENGTH”,”1024”);

response.setStatus(1024);

response.setHeader(“CONTENT-LENGTH”,1024);

Fenster schliessen

Choose the servlet code fragment that gets a binary stream for writing an image or other binary type to the HttpServletResponse.

java.io.PrintWriter out = response.getWriter();

ServletOutputStream out = response.getOutputStream();

java.io.PrintWriter out = new PrintWriter(response.getWriter());

ServletOutputStream out = response.getBinaryStream();

Fenster schliessen

Which methods are used by a servlet to handle form data from a client?
(Choose all that apply.)

HttpServlet.doHead()

ServletRequest.doGet()

HttpServlet.doPost()

ServletRequest.doPost()