com.octo.captcha
Class MockCaptcha

java.lang.Object
  extended by com.octo.captcha.MockCaptcha
All Implemented Interfaces:
Captcha, java.io.Serializable

public class MockCaptcha
extends java.lang.Object
implements Captcha

Version:
1.0
Author:
Marc-Antoine Garrigue
See Also:
Serialized Form

Field Summary
static java.lang.String CHALLENGE
           
static java.lang.String QUESTION
           
 
Constructor Summary
MockCaptcha(java.util.Locale locale)
           
 
Method Summary
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUESTION

public static final java.lang.String QUESTION
See Also:
Constant Field Values

CHALLENGE

public static final java.lang.String CHALLENGE
See Also:
Constant Field Values
Constructor Detail

MockCaptcha

public MockCaptcha(java.util.Locale locale)
Method Detail

getQuestion

public java.lang.String getQuestion()
Accessor captcha question.

Specified by:
getQuestion in interface Captcha
Returns:
the question

getChallenge

public java.lang.Object getChallenge()
Accerssor for the questionned challenge.

Specified by:
getChallenge in interface Captcha
Returns:
the challenge (may be an image for image captcha...

validateResponse

public java.lang.Boolean validateResponse(java.lang.Object response)
Validation routine for the response.

Specified by:
validateResponse in interface Captcha
Parameters:
response - to the question concerning the chalenge
Returns:
true if the answer is correct, false otherwise.

disposeChallenge

public 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!

Specified by:
disposeChallenge in interface Captcha

hasGetChalengeBeenCalled

public 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.

Specified by:
hasGetChalengeBeenCalled in interface Captcha
Returns:
true if getChallenge has been called false otherwise.


Copyright © 2003-2012 JCaptcha corp.. All Rights Reserved.