Ah, that makes loads more sense, thanks.
The principle of putting the thread that's servicing the incoming request is sound, but a problem arises if your malicious user sends multiple requests simultaneously.
You need to arrange to discard the "spare" offending requests, because if you create and block a thread for all of them that will cause you to run out of resources.
(edit) You don't necessarily need to use a Session, but you DO need to uniquely identify your incoming users. That can be by cookie. You could also take the approach of blocking by IP address (that can cause problems when one IP address is shared by a large number of users).
thanks for your recommendations...but if the user disables cookies from browser then my solution wont work...
i think it can be done with sessions...when flood detected the page will be redirected to a warning message like "plz try again later" and without delaying the thread...
what do you think?
> i think it can be done with sessions
Which proves only that you don't know how they work. How do you imagine the server keeps track of which user owns which session?
Bingo: generally a cookie (look for JSESSIONID). There's no quick fix here.
All the mechanisms that can be used to maintain a distinct session are susceptible to abuse by a malicious user. IP address identification isn't, but risks unfairly penalizing a user who's sharing an IP with an idiot.
I think If I were you I'd do this:
Track by IP address. If a "flood" of simultaneous posts appears to be coming from a particular IP address, enable the use of a CAPTCHA on the form(s) in question for that IP address only.
http://en.wikipedia.org/wiki/Captcha
That way you avoid inconveniencing nice guys, but make it too much hassle to bother for the SOBs.
got the idea but didnt understand about searching for ip adresses...they wont be stored in a db?will they?
you talked about jsessionid..i am searching about it but couldnt get valueable info...if you have any link write it and i will be very appreciated...
thanks a lot again
Burak
> got the idea but didnt understand about searching for
> ip adresses...they wont be stored in a db?will they?
No. But there's nothing to stop you from retaining this information. The IP address is available to servlets and filters as long as you're not behind any opaque infrastructure.
> you talked about jsessionid..i am searching about it
> but couldnt get valueable info...if you have any link
> write it and i will be very appreciated...
It's in the J2EE spec I presume, but it doesn't really matter - the point is that sessions are tracked in ways that are susceptible to manipulation by malicious end users.
>
> thanks a lot again
> Burak