aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes RequestDispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "RequestDispatcher" Watch "RequestDispatcher" New topic
Author

RequestDispatcher

Vinod Iyer
Ranch Hand

Joined: Apr 13, 2006
Posts: 53
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

Joined: Apr 13, 2006
Posts: 53
??
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9383
    
    2

I'm not understanding your question?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Saurabh Kumar
Ranch Hand

Joined: Aug 21, 2006
Posts: 56
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

Joined: Apr 13, 2006
Posts: 53
thanks Saurabh
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
good..!


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
 
Consider Paul's rocket mass heater.
 
subject: RequestDispatcher