All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.perimeterx.api.blockhandler.DefaultBlockHandler Maven / Gradle / Ivy

There is a newer version: 6.13.0
Show newest version
package com.perimeterx.api.blockhandler;

import com.perimeterx.models.PXContext;
import com.perimeterx.models.exceptions.PXException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import java.io.IOException;

/**
 * Default blocking implementation - Sends 403
 * 

* Created by shikloshi on 03/07/2016. */ public class DefaultBlockHandler implements BlockHandler { public void handleBlocking(PXContext context, HttpServletResponseWrapper responseWrapper) throws PXException { responseWrapper.setStatus(HttpServletResponse.SC_FORBIDDEN); responseWrapper.setContentType("text/html"); try { responseWrapper.getWriter().print(getHtml(context)); } catch (IOException e) { throw new PXException(e); } } private String getHtml(PXContext context) { return "\n" + " \n" + " \n" + " \n" + " Access to This Page Has Been Blocked\n" + " \n" + " \n" + " \n" + "

\n" + " Access to This Page Has Been Blocked \n" + "
\n" + "
Access to '" + context.getFullUrl() + "' is blocked according to the site security policy.
Your browsing behaviour fingerprinting made us think you may be a bot.

This may happen as a result of the following: \n" + "
    \n" + "
  • JavaScript is disabled or not running properly.
  • \n" + "
  • Your browsing behaviour fingerprinting are not likely to be a regular user.
  • \n" + "
\n" + " To read more about the bot defender solution: https://www.perimeterx.com/bot-defender
If you think the blocking was done by mistake, contact the site administrator.
\n" + "
Block Reference: #' " + context.getUuid() + "' \n" + "
\n" + " \n" + ""; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy