Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

urgent Help in program !!

 
Saurabh Agrawal
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends ,
I have this function which deals with handling client request when doget() is called but i am unable to make out what does this uri part of it actually does ??? i mean these people are trying to resolve the URI from the cleint to extract some information based on which a page is genarted and send to the client .. can u clarify me wat wopuld uri contain ultimately when this is invoked ..i hope you guys help me out ..

Thanks ,
Saurabh

Line of code :


private void handleDefault(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
/* Validate user has logged in. */
long processStartTime;

HttpSession session = req.getSession(false);
if (session != null) {
int servletNamePortion = req.getContextPath().length() + req.getServletPath().length();
String uri = req.getRequestURI().substring(servletNamePortion);
req = new HttpServletRequestAdapter(req);
if (SERVLET_DEBUG_PERFORMANCE) {
processStartTime = System.currentTimeMillis();
}
dispatchPage(uri, req, resp, null);
if (SERVLET_DEBUG_PERFORMANCE) {
System.out.println("=== Servlet Performance === " + (System.currentTimeMillis() - processStartTime) +
" Milliseconds to process URI " + uri);
}
}
}
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) slow down. English isn't Latin, punctuation really helps to make your sentences readable.
2) the just extract the request parameters and pass those to another function, presumably to add them to another request.
3) don't panic
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
4) "urgent Help in program!!" does not tell us ANYTHING!
Please use the title to give some idea of what the problem is.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
42) 42 The ultimate answer
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic