BotDetect Java CAPTCHA Ant Build Dependency

BotDetect Java Captcha dependency in an Apache ANT Build

Add target to application's Buildfile to get the BotDetect Java Captcha Library jar from git.captcha.com repository:

<!-- Download dependence -->
<target name="get-deps" description="retrieve dependencies manually">
    <echo message="Getting dependencies..." />
    <mkdir dir="lib" />
    <get src="https://git.captcha.com/botdetect-java-captcha.git/blob_plain/HEAD:/com/captcha/botdetect/4.0.beta3.7/botdetect-4.0.beta3.7.jar" dest="lib/botdetect-4.0.beta3.7.jar" usetimestamp="true" />
    <get src="https://git.captcha.com/botdetect-java-captcha.git/blob_plain/HEAD:/com/captcha/botdetect-servlet/4.0.beta3.7/botdetect-servlet-4.0.beta3.7.jar" dest="lib/botdetect-servlet-4.0.beta3.7.jar" usetimestamp="true" />
    <get src="https://git.captcha.com/botdetect-java-captcha.git/blob_plain/HEAD:/com/captcha/botdetect-jsp20/4.0.beta3.7/botdetect-jsp20-4.0.beta3.7.jar" dest="lib/botdetect-jsp20-4.0.beta3.7.jar" usetimestamp="true" />
    <get src="https://git.captcha.com/botdetect-java-captcha.git/blob_plain/HEAD:/com/captcha/botdetect-jsf20/4.0.beta3.7/botdetect-jsf20-4.0.beta3.7.jar" dest="lib/botdetect-jsf20-4.0.beta3.7.jar" usetimestamp="true" />
    ...
</target>

In case your application uses JSF 1.2 you will need to add botdetect-jsf12 instead of botdetect-jsf20.

BotDetect Java Captcha Api is now ready to be used in project.

Reference the target 'get-deps' from previous step in a compile target:

<target name="compile" depends="init, get-deps" description="compile source code">
  <copydir src="${web.dir}" dest="${build.dir}" />
  <mkdir dir="${web.classes.dir}" />
  <javac destdir="${web.classes.dir}" source="${jdk.version}" target="${jdk.version}"
    debug="true" includeantruntime="false" classpathref="compile.path">
    <src path="${src.dir}" />
  </javac>
</target>

Configure BotDetect CaptchaServlet

Next, it is mandatory to configure BotDetect Captcha servlet by adding the following entry to your app's config (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>

The following integration steps depend on your particular usage scenario, and what kind of technology stack you intend to use.

Adding BotDetect Java Captcha to JSP forms

Here is where you can find how to add BotDetect CAPTCHA Protection to JSP Forms.

Adding BotDetect Java Captcha to file JSF forms

Here is where you can find how to add BotDetect CAPTCHA Protection to JavaServer Faces Applications.

Adding BotDetect Java Captcha to Spring MVC forms

Here is where you can find how to integrate BotDetect Java Captcha into Spring MVC Applications.

Adding BotDetect Java Captcha to Struts Forms

Here is where you can find how to integrate BotDetect Java Captcha into Struts Applications.

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.