aspose file tools*
The moose likes Servlets and the fly likes urgent Help in program !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "urgent Help in program !!" Watch "urgent Help in program !!" New topic
Author

urgent Help in program !!

Saurabh Agrawal
Ranch Hand

Joined: Oct 07, 2003
Posts: 244
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);
}
}
}


Success is not doing extraordinary things but doing ordinary things extraordinarily well.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
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


42
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
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

Joined: Oct 12, 2000
Posts: 5093
42) 42 The ultimate answer
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: urgent Help in program !!