|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.octo.captcha.service.AbstractCaptchaService
public abstract class AbstractCaptchaService
This is a base class for CaptchaService implementations. It implements the lyfe cycle stuff. It uses : a CaptchaStore to store captcha during the life cycle, and a CaptchaEngine to build captchas. All concrete implementation (that uses a specific capthcaStore and captchaEngine) should provide a default non argument constructor (by subclassing this class, and calling the constructor of the abstract class)
Field Summary | |
---|---|
protected CaptchaEngine |
engine
|
protected Log |
logger
|
protected CaptchaStore |
store
|
Constructor Summary | |
---|---|
protected |
AbstractCaptchaService(CaptchaStore captchaStore,
CaptchaEngine captchaEngine)
|
Method Summary | |
---|---|
protected Captcha |
generateAndStoreCaptcha(java.util.Locale locale,
java.lang.String ID)
|
protected abstract java.lang.Object |
getChallengeClone(Captcha captcha)
This method must be implemented by sublcasses and : Retrieve the challenge from the captcha Make and return a clone of the challenge Return the clone It has be design in order to let the service dispose the challenge of the captcha after rendering. |
java.lang.Object |
getChallengeForID(java.lang.String ID)
Method to retrive the challenge corresponding to the given ticket from the store. |
java.lang.Object |
getChallengeForID(java.lang.String ID,
java.util.Locale locale)
Method to retrive the challenge corresponding to the given ticket. |
java.lang.String |
getQuestionForID(java.lang.String ID)
Method to retrive the question corresponding to the given ticket from the store. |
java.lang.String |
getQuestionForID(java.lang.String ID,
java.util.Locale locale)
Method to retrive the question corresponding to the given ticket. |
java.lang.Boolean |
validateResponseForID(java.lang.String ID,
java.lang.Object response)
Method to validate a response to the challenge corresponding to the given ticket and remove the coresponding captcha from the store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected CaptchaStore store
protected CaptchaEngine engine
protected Log logger
Constructor Detail |
---|
protected AbstractCaptchaService(CaptchaStore captchaStore, CaptchaEngine captchaEngine)
Method Detail |
---|
public java.lang.Object getChallengeForID(java.lang.String ID) throws CaptchaServiceException
getChallengeForID
in interface CaptchaService
ID
- the ticket provided by the buildCaptchaAndGetID method
CaptchaServiceException
- if the ticket is invalidpublic java.lang.Object getChallengeForID(java.lang.String ID, java.util.Locale locale) throws CaptchaServiceException
getChallengeForID
in interface CaptchaService
ID
- ticketlocale
- the desired localized capthca
CaptchaServiceException
- if the ticket is invalidpublic java.lang.String getQuestionForID(java.lang.String ID, java.util.Locale locale) throws CaptchaServiceException
getQuestionForID
in interface CaptchaService
ID
- ticketlocale
- the desired localized capthca
CaptchaServiceException
- if the ticket is invalidpublic java.lang.String getQuestionForID(java.lang.String ID) throws CaptchaServiceException
getQuestionForID
in interface CaptchaService
ID
- the ticket provided by the buildCaptchaAndGetID method
CaptchaServiceException
- if the ticket is invalidpublic java.lang.Boolean validateResponseForID(java.lang.String ID, java.lang.Object response) throws CaptchaServiceException
validateResponseForID
in interface CaptchaService
ID
- the ticket provided by the buildCaptchaAndGetID method
CaptchaServiceException
- if the ticket is invalidprotected Captcha generateAndStoreCaptcha(java.util.Locale locale, java.lang.String ID)
protected abstract java.lang.Object getChallengeClone(Captcha captcha)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |