File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "urgent Help in program !!" Watch "urgent Help in program !!" New topic

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 ,

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);
processStartTime = System.currentTimeMillis();
dispatchPage(uri, req, resp, null);
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

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
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
I agree. Here's the link:
subject: urgent Help in program !!
It's not a secret anymore!