The DataDome Developer Hub

Welcome to the DataDome developer hub. You'll find comprehensive guides and documentation to help you start working with DataDome as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Java Module Setup

About

The DataDome Java Module is a custom servlet filter which intercepts the request and response and sends it to DataDome servers to detect bot traffic.

Installation

With Maven

<project>
...
    <repositories>
    ...
        <repository>
            <id>bintray-datadome-org-datadome</id>
            <name>DataDome bintray repo</name>
            <url>http://dl.bintray.com/datadome-org/datadome</url>
        </repository>
    ...
    </repositories>
    <dependencies>
    ...
        <dependency>
          <groupId>co.datadome.api</groupId>
          <artifactId>datadome-java-module</artifactId>
          <version>1.3</version>
        </dependency>
    ...
    </dependencies>
...
</project>

Manual Installation

  1. Download archive
https://package.datadome.co/linux/DataDome-Java-v1.3.tgz
  1. The downloaded zip file includes sources, so you can directly install it to your local maven repository:
    mvn install
    

By default it build with servlet-api-3.1 and if you're used application server with servlet-api-3.0
you should build it by hands with different profile:

mvn -P servlet-api-3.0 install

Usage

Filter has been tested on jetty and should work with Jboss and other servers supporting servlet api.

To use the filter you just need add it to web.xml as first server.

For eample:

<web-app>
...
    <filter>
        <filter-name>datadome-filter</filter-name>
        <filter-class>com.datadome.co.servlet.DataDomeFilter</filter-class>
        <init-param>
            <param-name>datadome.apikey</param-name>
            <param-value>YOUR_SECRET_LICENSE_KEY</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>datadome-filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
...
</web-app>

You can also specified additional parametrs likes hostname or timeout.

List of possible init parametrs:

Settings Description Default
datadome.apikey License key to access API
datadome.hostname Hostname of API server api.datadome.co
datadome.ssl Use SSL between the filter and the API server true
datadome.regex Inclusion regex ""
datadome.exclusion_regex Exclusion regex \.(js|css|jpg|jpeg|png|ico|gif|tiff|svg|woff|woff2|ttf|eot|mp4|otf)$
datadome.connection_timeout Connection timeout (in ms) 150
datadome.read_timeout Read timeout (in ms) 50
datadome.max_connections Maximum open connection to the API server 100

You can use environment variables inside DataDome filter's param-value.

For example if you have system environment variable DATADOME_API_KEY with your API key, you can put to web.xml:

        <init-param>
            <param-name>datadome.apikey</param-name>
            <param-value>${DATADOME_API_KEY}</param-value>
        </init-param>

Java Module Setup