com.octo.captcha
Interface Captcha
- All Superinterfaces:
- java.io.Serializable
- All Known Implementing Classes:
- FishEye, Gimpy, GimpySound, ImageCaptcha, MathCaptcha, SoundCaptcha, SpellerSound, SpellFindCaptcha, TextCaptcha
public interface Captcha
- extends java.io.Serializable
This interface represent a CAPTCHA.
A CAPTCHA is a program that can generate and grade tests that: - Most humans can pass.
- Current
computer programs can't pass
see http://www.captcha.net/ for sample, articles, and definitions.
A captcha is basically a test composed of : - A question about :
- a challenge (can be an image for
image captchas or a sound, or wathever)
- a validation routine a of a given response
This is a container for the CAPTCHA challenge which is also able to validate the answer. Class implementing this
interface must follow the rules : - As all 'components' of this project, all contructed objects should be
abble to word (ie no need to set other properties to obtain a fully fonctional object). constructor
- It must
not build the challenge! use instead the CaptchaFactory
- It must know how to validate the answer
- It
must not expose the answer
- It must dispose the challenge when the getChallenge method is called(The
challenge must be showed only once )
;
Method Summary |
void |
disposeChallenge()
Dispose the challenge, once this method is call the getChallenge method will return null. |
java.lang.Object |
getChallenge()
Accerssor for the questionned challenge. |
java.lang.String |
getQuestion()
Accessor captcha question. |
java.lang.Boolean |
hasGetChalengeBeenCalled()
This method should return true if the getChalenge method has been called (has been added in order to properly
manage the captcha state. |
java.lang.Boolean |
validateResponse(java.lang.Object response)
Validation routine for the response. |
getQuestion
java.lang.String getQuestion()
- Accessor captcha question.
- Returns:
- the question
getChallenge
java.lang.Object getChallenge()
- Accerssor for the questionned challenge.
- Returns:
- the challenge (may be an image for image captcha...
validateResponse
java.lang.Boolean validateResponse(java.lang.Object response)
- Validation routine for the response.
- Parameters:
response
- to the question concerning the chalenge
- Returns:
- true if the answer is correct, false otherwise.
disposeChallenge
void disposeChallenge()
- Dispose the challenge, once this method is call the getChallenge method will return null.
It has been added
for technical reasons : a captcha is always used in a two step fashion
First submit the challenge, and then
wait until the response arrives.
It had been asked to have a method to dispose the challenge that is no
longer used after being dipslayed. So here it is!
hasGetChalengeBeenCalled
java.lang.Boolean hasGetChalengeBeenCalled()
- This method should return true if the getChalenge method has been called (has been added in order to properly
manage the captcha state.
- Returns:
- true if getChallenge has been called false otherwise.
Copyright 2003-2009 JCaptcha. All Rights Reserved.