• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher

 
Vinod Iyer
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone confirm this

1. if i use getRequestDispatcher("string") to get the dispatcher and then

a. use forward on the dispatcher -
the following attributes :

Value of javax.servlet.include.request_uri : will be same the first request in the filterchain or same as those of servlet from which request was forwarded


javax.servlet.include.context_path - will be same the first request in the filterchain or same as those of servlet from which request was forwarded


javax.servlet.include.servlet_path - will be same the first request in the filterchain or same as those of servlet from which request was forwarded


javax.servlet.include.path_info - will be same the first request in the filterchain or same as those of servlet from which request was forwarded

javax.servlet.include.query_string - querystring used while creating requestdispatcher


b use include on the dispatcher -
the following attributes :


Value of javax.servlet.include.request_uri : will be that of requestdispather and not be the value of the servlet which included this page

javax.servlet.include.context_path : will be that of requestdispather and not be the value of the servlet which included this page

javax.servlet.include.servlet_path : will be that of requestdispather and not be the value of the servlet which included this page

javax.servlet.include.path_info : will be that of requestdispather and not be the value of the servlet which included this page

javax.servlet.include.query_string - querystring used while creating requestdispatcher




2. if getNamedDispatcher is used

a. include / forward

javax.servlet.include.request_uri - not set
javax.servlet.include.context_path - not set
javax.servlet.include.servlet_path - not set
javax.servlet.include.path_info - not set
javax.servlet.include.query_string - not set
[ February 21, 2007: Message edited by: Vinod Iyer ]
 
Vinod Iyer
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
??
 
Joe Harry
Ranch Hand
Posts: 10082
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not understanding your question?
 
Saurabh Kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vinod,

This is correct.
1. w.r.t RequestDispatcher & forward:
From SRV.8.4.2:
The values of these attributes must be equal to the return values of the
HttpServletRequest methods getRequestURI, getContextPath, getServletPath,
getPathInfo, getQueryString respectively, invoked on the request object passed to the first servlet object in the call chain that received the request from the client.
These attributes are accessible from the forwarded servlet via the
getAttribute method on the request object. Note that these attributes must always reflect the information in the original request even under the situation that multiple forwards and subsequent includes are called.



2. w.r.t RequestDispatcher & include:
From SRV.8.3.1:
These attributes are accessible from the included servlet via the getAttribute method on the request object and their values must be equal to the request URI, context path, servlet path, path info, and query string of the included servlet, respectively.



3. w.r.t RequestDispatcher obtained using getNamedDispatcher method, these attributes are not set.

Thanks and regards,
saurabh
 
Vinod Iyer
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Saurabh
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
good..!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic