Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What happens after sendredirect?  RSS feed

 
Sachin Pathare
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens after sendredirect? i mean the flow/process right from the method is called to the servlet(URL passed as a parameter to method) is called?
Thanks in advance
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A redirect is a response code that is sent to the client (browser, usually). When the browser receives this response, it (usually) will just send a new request to the new resource (as specified in the original redirect response).

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sachin Pathare wrote:What happens after sendredirect? i mean the flow/process right from the method is called to the servlet(URL passed as a parameter to method) is called?

I dont understand clearly . do you mean *if a method[say print] in servlet call sendRedirect after that the execution flow retrun to that particular method(print) or not*? ,

if this is your question then *YES* . it is just an Ordinary method call another method scenario
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch Sachin Pathare
 
Sachin Pathare
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thanks Seetharaman
no i don't mean only the method call, my question is what happens internally when this method is called( like a new request is created), why can't we create a new request object and send it across instead of container creating the new request object.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sachin Pathare wrote:why can't we create a new request object and send it across instead of container creating the new request object.


creating own request/response is tedious . Container do for you effectively
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you mean by "create a new request object and send it across", but it sounds as if you may be confused about the difference between a server-side forward and a client-side redirect; both are used for different purposes, and work in rather different ways.
 
Sachin Pathare
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but what happens internally when this method is called, what's the flow?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "internally" - the code flow in the servlet container? That will differ from server to server, so it's not very useful information. Mark has already described the general flow; you can observe that in action using a tool like the Firefox extension LiveHttpHeaders, or a local HTTP proxy such as tcpmon.
 
Sachin Pathare
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!