public class CaptchaServiceSingleton
{
/* Instantiate a Singleton CaptchaService */
private static ImageCaptchaService instance = new DefaultManageableImageCaptchaService();
public static ImageCaptchaService getInstance()
{
return instance;
}
}
public Boolean validateResponseForID(String ID, Object response)throws CaptchaServiceException
{
if (!store.hasCaptcha(ID))
{
throw new CaptchaServiceException("Invalid ID, could not validate!");
}
else
{
Boolean valid = store.getCaptcha(ID).validateResponse(response);
return valid;
}
}