View Javadoc

1   /*
2    * JCaptcha, the open source java framework for captcha definition and integration
3    * Copyright (c)  2007 jcaptcha.net. All Rights Reserved.
4    * See the LICENSE.txt file distributed with this package.
5    */
6   
7   package com.octo.captcha.sound.spellfind;
8   
9   import com.octo.captcha.sound.SoundCaptcha;
10  
11  import javax.sound.sampled.AudioInputStream;
12  
13  /***
14   * <p><ul><li></li></ul></p>
15   *
16   * @author <a href="mailto:marc.antoine.garrigue@gmail.com">Marc-Antoine Garrigue</a>
17   * @version $Id: SpellFindCaptcha.java 471 2008-02-11 21:40:12Z antoineveret $
18   */
19  public class SpellFindCaptcha extends SoundCaptcha {
20  
21       private String response;
22  
23        public SpellFindCaptcha(String thequestion,
24                            AudioInputStream thechallenge, String theresponse) {
25            super(thequestion, thechallenge);
26            this.response = theresponse;
27        }
28  
29        public Boolean validateResponse(Object theresponse) {
30            if ((theresponse != null) && (theresponse instanceof String)) {
31                return this.validateResponse((String) theresponse);
32            } else {
33                return Boolean.FALSE;
34            }
35        }
36  
37        public Boolean validateResponse(String theresponse) {
38            return Boolean.valueOf(this.response.equalsIgnoreCase(theresponse));
39        }
40  
41  }