Karten 62 Karten
Lernende 1 Lernende
Sprache English
Stufe Andere
Erstellt / Aktualisiert 12.09.2017 / 04.10.2017
Lizenzierung Keine Angabe     (Fabrizi)
0 Exakte Antworten 62 Text Antworten 0 Multiple Choice Antworten
Fenster schliessen

Which method(s) can change the HTTP-Header and what is the difference?

response.setIntHeader("key", 7);  ->  Changes existing or creates new header key

response.setHeader("key", "value");  ->  Changes existing or creates new header key

response.addHeader("key", "value");  ->  Adds value to existing or creates new header key

Fenster schliessen

How can a request be forwarded to another URL from a servlet?


Fenster schliessen

What happens when a relative URL is passed to the method
for redirecting, starting either with a slash or not?

If it starts with a slash, it will be relative to the container-root.

If not, it will be relative to the original URL.

Fenster schliessen

What will be the result of redirecting a request,
after the response has already been passed?

An IllegalStateException.

Fenster schliessen

Where are the following methods declared?

getMethod(), getHeader(), getCookies()


Fenster schliessen

What does a container take care of?

Networking, lifecycle management, threading, declarative security and JSP support.

Fenster schliessen

What does the container do, when a user clicks a link, 
that has a URL to a servlet instead of a static page?

  • The container “sees” that the request is for a servlet, so it creates two objects:
    HttpServletResponse and HttpServletRequest.
  • The container finds the correct servlet based on the URL in the request,
    creates a thread for that request and passes the request and response objects to it.
  • The container calls the servlet’s service() method, which automatically calls
    either the doGet() or doPost() method.
  • The doGet() or doPost() method generates the dynamic page
    and adds it to the response object.
  • The thread completes, the container converts the response object into an HTTP response,
    returns it to the client and deletes the request and response objects.
Fenster schliessen

What is the complete signature of the doGet() method?

public void doGet(HttpServletRequest request, HttpServletResponse response)