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.gimpy;
8   
9   import com.octo.captcha.sound.SoundCaptcha;
10  
11  import javax.sound.sampled.AudioInputStream;
12  
13  /***
14   * <p>Description: </p>
15   *
16   * @author <a href="mailto:mga@octo.com">Mathieu Gandin</a>
17   * @author Benoit Doumas
18   * @version 1.0
19   */
20  public class GimpySound extends SoundCaptcha {
21  
22  	private String response;
23  
24      public GimpySound(String thequestion,
25                        AudioInputStream thechallenge, String theresponse) {
26          super(thequestion, thechallenge);
27          this.response = theresponse;
28      }
29  
30      public Boolean validateResponse(Object theresponse) {
31          if ((theresponse != null) && (theresponse instanceof String)) {
32              return this.validateResponse((String) theresponse);
33          } else {
34              return Boolean.FALSE;
35          }
36      }
37  
38      public Boolean validateResponse(String theresponse) {
39          return Boolean.valueOf(this.response.equalsIgnoreCase(theresponse));
40      }
41  
42  }