File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes redirect takes infinite time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "redirect takes infinite time" Watch "redirect takes infinite time" New topic

redirect takes infinite time

Ravi Saluru

Joined: Nov 01, 2011
Posts: 11


I have a requirement in which I need to check the file size which is being uploaded. I have a limit of 10 MB, more than which I should not allow the upload. As I tried client side validation, and was successful only with mozilla and firefox as they support file.size functionality. IE on the other needs support of ActiveX which is denied.

Coming to Client side validation, I am checking if request.getContentLength greater than 10 MB, then redirect to error page.

It works great for files around 100 or 200 MB. I tried for 2 GB file, the redirect takes forever, and the timeout set is 60 secs. Still I am not able to load the error Page. Any suggestion why the redirect is not happening if the file sizes are huge ?


Thanks and Regards,
Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2851

By timeout you mean session timeout?
I think you can put a Javascript on the page which processes the redirect.
If there is no redirect after say 10 secs, directly call the error page.
Not sure if this is what you are looking for.

One more thing is use a Flash based uploader which is quite sophisticated than the traditional ones.

Hope this helps.

|Asking Good Questions|
Ravi Saluru

Joined: Nov 01, 2011
Posts: 11

Flash is not supported, the validation has to be done at the server side!
Ravi Saluru

Joined: Nov 01, 2011
Posts: 11

I have done the server side validation by checking the file size using the getContentLength.

The condition check is fine, but the call is looped between server and client machine for infinite time.

What could be the possible reasons about why the call is looped between server and client(in JSP and Servlet scenario) and during this period the client browser seems to be loading all the time. The target JSP is never shown though the call is forwarded to that JSP(this I verified from the logs).

I agree. Here's the link:
subject: redirect takes infinite time
It's not a secret anymore!