This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes Stop Request uploading file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Stop Request uploading file" Watch "Stop Request uploading file" New topic

Stop Request uploading file

Dimiter Stoilov

Joined: Aug 11, 2004
Posts: 10
Hi ranchers,
I have a multipart form uploading file. I want to limit the file upload to say 5mb. Everithing is fine, But with large uploads, request parse the whole input until it show my for the 5mb limitation.

I tried to stop the request parsing the whole file.
Tried by redefining the request it in ServletRequestWrapper, changing its getInputStream method, throwing exceptions, calling RequestDispatcher, but no successs. Request have to parse whole file, after that it shows me whatever i told him to do.

Can you answer me is this HTTP protocol requirement or any hacks to stop the request?

Thank you for you time
I agree. Here's the link:
subject: Stop Request uploading file
It's not a secret anymore!