Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dispatching req from one servlet to another

 
mahend pachpor
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once We get a request form client ie html to first servlet

Servlet should wait for some time and then dispatch the request to another servlet or client

I had tried this by creating a thread in the servlet and by using sleep method I tried to delay the despatching but it is not happing
It directly dispatches to another servlet and gives the output

So please help me..
 
Arvind Giri
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I didn't get why are you creating a new thread and then calling sleep. I think a direct call to Thread.sleep inside your service methods(doGet,doPost,...) should do the job.

Still, it would be more helpful for us if we get to have a look at that piece of code....
 
Boobalan Pillai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You dont need to write any thread code.you can use the following code instead

response.addHeader("REFRESH","5;url=/webapps/root/index.html/");

This will wait for 5 seconds then display the index.html

Regards
Bala.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic