BotDetect Java CAPTCHA Generator

Unlike Recaptcha the Stalker -- BotDetect CAPTCHA works in China! Licensable source-code; self-hosted -- doesn't stalk -- nor does it slurp your form-data! Think: GDPR & LGPD!

Java CAPTCHA Generator Highlights:

  • NATIONAL-SECURITY & PRIVACY FRIENDLY:
  • Self-hosted Java Captcha library -- no 3rd-party servers involved
  • Where having no 3rd-party servers involved also means:
    • no QUIC server-config/source-address-token & n-RTT session resumption
    • no TLS v1.3 PSK & n-RTT session resumption
    • no TLS v1.2 Session Ticket / Session ID session resumption
    • no cross-domain-shared TLS states
    • no TLS Channel IDs
    • no Token Binding
    • no old-school cookies-based ways of user identification and stalking
  • From a vendor that is not in the stalking business
    • nor a part of PRISM or XKeyscore
    • nor has anything to do with the NSA
  • Lets you never have 3rd-parties:
    • identify and stalk users on your site
    • slurp national-security-sensitive or privacy-sensitive form-data from your site
  • Plays nicely with Firefox, TOR Browser, and VPN users
  • NOTHING TO HIDE HERE:
  • Licensable source-code (Java/JavaScript) -- to fit neatly in your code audit processes
  • MULTINATIONALS FRIENDLY:
  • Works in China
  • Allows for EU GDPR and Brazilian LGPD compliant sites -- no need to risk those enormous multi-million dollar fines
  • 56 audio localizations (including all 24 official EU languages) let you treat each local market with that particular local market's familiar combination of script and language
  • EASY FRONTEND INTEGRATIONS:
  • Out-of-the-box integrations with various JavaScript frontends:
  • EASY BACKEND INTEGRATIONS:
  • Out-of-the-box integrations with various Java backends:
  • DEVOPS FRIENDLY:
  • TestMode-enabled -- ready for your CI/CD pipelines
  • ACCESSIBLE:
  • Produces XHTML 1.1 Strict, Section 508 and WCAG AAA compliant markup
  • Accompanied with legible images and recognizable audios
  • MISCELLANEOUS:
  • 60 secure & readable Captcha image styles
  • 20 secure & accessible audio Captcha sound styles
  • Custom Captcha image size, code length, css & icons, tooltips, and pretty much everything else...
  • Full support for all major browsers and all Android & iOS devices

Quickstarts:

BotDetect Java Captcha generator allows you to easily add Captcha protection to various types of Java based web forms.

We'll use default BotDetect settings in all code snippets.

To see how powerful and customizable BotDetect is, check the BotDetect features demo.

1. Show a Captcha Challenge on the JSF Form

BotDetect Java Captcha provides a dedicated JavaServer Faces tag 'jsfCaptcha'.

'jsfCaptcha' integration steps depend on whether you use standard JSF (.jsp) or Facelets (.xhtml) view handler(s).

Standard JSF

  • declare taglib at the begining of the .jsp file:
  • <%@taglib prefix="botDetect" uri="https://captcha.com/java/jsf"%>
    
  • add (optionaly) attribute prependId="false" to <h:form> opening tag
  • within the <form> insert:
  • <h:outputLabel for="captchaCode" 
      value="Retype the characters from the picture:"/>
      
    <botDetect:jsfCaptcha id="exampleCaptcha" 
                          userInputID="captchaCode"
                          binding="#{captchaExampleBean.captcha}"/>
                          
    <h:inputText id="captchaCode" value="#{captchaExampleBean.captchaCode}"/>
    

When you open your form in a browser, the markup given above should render similar as:

BotDetect CAPTCHA added to an JSP page

In order to later perform CAPTCHA validation jsfCaptcha tag must be bound with the corresponding property of the backing bean. This backing bean property should be of the JsfCaptcha type, and include both getter and setter access:

import botdetect.web.jsf.JsfCaptcha;
  [...]

private JsfCaptcha captcha;
  [...]

public JsfCaptcha getCaptcha() {
   return captcha;
}

public void setCaptcha(JsfCaptcha captcha) {
   this.captcha = captcha;
}

2. Validate User's Captcha Input During Form Submission

On form submit, the Captcha validation result must be checked:

boolean isHuman = captcha.validate(captchaCode);
if (isHuman) {
  correctLabelVisible = true;
  incorrectLabelVisible = false;
} else {
  correctLabelVisible = false;
  incorrectLabelVisible = true;
}

3. Add BotDetect Java CAPTCHA Library Dependency

Here is how to add BotDetect Java CAPTCHA Library dependency in various dependency management scenarios:

To manually add BotDetect Captcha library to classpath, copy the following four jar files from BotDetect Java download package to application's WEB-INF/lib folder:

  • botdetect-4.0.beta3.7.jar
  • botdetect-servlet-4.0.beta3.7.jar
  • botdetect-jsp20-4.0.beta3.7.jar
  • botdetect-jsf20-4.0.beta3.7.jar

In case your application uses JSF 1.2 you will need to copy the botdetect-jsf12-4.0.beta3.7.jar file instead of botdetect-jsf20-4.0.beta3.7.jar file.

To share BotDetect Captcha among multiple applications, these BotDetect jar files above should be copied into 'lib' directory of web container or application server's domain.

4. Register BotDetect Captcha Servlet

Update your application configuration (web.xml) file.

<servlet>
  <servlet-name>BotDetect Captcha</servlet-name>
  <servlet-class>com.captcha.botdetect.web.servlet.CaptchaServlet</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>BotDetect Captcha</servlet-name>
  <url-pattern>/botdetectcaptcha</url-pattern>
</servlet-mapping>

BotDetect Java CAPTCHA Free version

You can download BotDetect Java CAPTCHA library for free and use it immediately! Your forms can be protected from spam (and bots in general) in minutes.

If you need any assistance integrating BotDetect or have any questions or feedback, our Support department is at your disposal.

Once the BotDetect Captcha generator library has been integrated into your Java web application and you're satisfied with how it works, it's easy to upgrade your license if you need the extra features and options offered by commercial BotDetect versions.

BotDetect Java Captcha Free Download

BotDetect Java CAPTCHA System Requirements

OS Application Server Java Browser

Supported Operating Systems:

  • Linux
  • Windows

Supported servers:

  • Apache Tomcat 5+
  • JBoss/WildFly 4+
  • WebSphere 6+
  • WebLogic 9+
  • GlassFish 2+
  • Resin 3+
  • Jetty 5+

Java, Servlet, JSP, JSF:

  • Java 5+
  • Java Servlet 2.3+
  • JavaServer Pages 2.0+
  • JavaServer Faces 1.2+

Officially Supported Browsers*:

  • Chrome 49+
  • Edge 20+
  • Firefox 52+
  • IE 8+
  • Opera 36+
  • Safari (OSX) 5+
  • Safari (iOS 6+)

Numerous other browsers are not officially supported but the captcha still works.

Read the notes below!

*

'Officially Supported Browsers' are those browsers for which we do the testing in order to ensure that both the image and audio captcha options are working properly.

Nonetheless, both the image and audio captcha options are working properly in the most of non-archaic ** browsers anyway -- officially-supported, or not -- while the image captcha option alone works in all of them!

If you find our 'Officially Supported Browsers' policy too-restrictive check Recaptcha the Stalker's one that says:

  • We support the two most recent major versions of the following:

    • desktop (Windows, Linux, Mac): Chrome, Firefox, Safari, IE

    • mobile: Chrome, Safari, Android native browser (4.0+)

We guess that after checking the Recaptcha's policy -- you will consider ours as the accommodative one :).

**

Archaic browsers?

At present, our 'Archaic Browsers' policy works this way:

  • Those last remaining few real humans still browsing around using the WinXP should update their browsers to the latest version that still works on the XP.

Or, in the less nice words:

  • If those last remaining few laggards cannot be bothered to update their browsers -- we cannot be bothered neither -- nor you should be!

  • Half of the Internet is broken for them since years ago anyway -- and they do not seem to care!


Please Note

BotDetect Java Captcha Library v4.0.Beta3.7 is an in-progress port of BotDetect 4 Captcha, and we need you to guide our efforts towards a polished product. Please let us know if you encounter any bugs, implementation issues, or a usage scenario you would like to discuss.