137 Understanding sendRedirect(-) method of Servlet | Adv Java Servlet Tutorial

Описание к видео 137 Understanding sendRedirect(-) method of Servlet | Adv Java Servlet Tutorial

#Understanding of #sendRedirect(-) method of #servlet:
CASE 1: Source Servlet Program and destination servlet program are present in same web application of same server.
With respect to Figure A:
Advance java servlet programming tutorial
1) Browser Window gives initial request to Srv1 Program(Source Servlet).
2) All the statements of Srv1 Program(Source Servlet) executes including response.sendRedirect("/s2url") method.

3) Since response.sendRedirect method is executed, the entire output HTML of Srv1 Program(Source Servlet) will be discarded.
Srv1 Program(Source Servlet) sends implicit response to browser window having destiantion program URL placed in response.sendRedirct("/s2url") method. Response status code of this implicit response is 300 to 399 giving instruction to browser window to perform redirection.

4) Browser window generates implicit request to destination servlet Prgram (Srv2) based on URL gathered from implicit response.

5) All the statements placed of Srv2(Destionation Servlet program) will be executed.

6) The output of generated by Srv2(Destionation Servlet program) goes to browser window as final response.


CASE 2: Source Servlet Program and destination servlet program are present in two different web applications of two different server machines.
------------------------------------------------------------
With respect to Figure B:

1) Browser Window gives initial request to Srv1 Program(Source Servlet). (WebAppOne of Tomcat Server Machine1)

2) All the statements of Srv1 Program(Source Servlet) executes including response.sendRedirect("http://Machine30:7070/WebApp2/s2url") method.

3) Since response.sendRedirect(http://Machine30:7070/WebApp2/s2url) method is executed, the entire output HTML of Srv1 Program(Source Servlet) will be discarded.

Srv1 Program(Source Servlet) sends implicit response to browser window having destination program URL placed in response.sendRedirct("http://Machine30:7070/WebApp2/s2url") method. Response status code of this implicit response is 300 to 399 giving instruction to browser window to perform redirection.

4) Browser window generates implicit request to destination servlet Prgram (Srv2) of WebApp2 of Machine30 of Weblogic server based on URL gathered from implicit response.

5) All the statements placed of Srv2(Destionation Servlet program) will be executed.

6) The output of generated by Srv2(Destionation Servlet program) WebApp2 of Machine30 of Weblogic server goes to browser window as final response.

#Key Points about sendRedirerct Method:

Комментарии

Информация по комментариям в разработке