Basic Configuration
1 // Create configuration object 2 PXConfiguration pxConfiguration = new PXConfiguration.Builder() 3 .cookieKey(COOKIE_KEY) 4 .authToken(AUTH_TOKEN) 5 .appId(APP_ID) 6 .blockingScore(SCORE) 7 .moduleMode(ModuleMode.BLOCKING) 8 .build(); 9 10 // Get instance 11 PerimeterX enforcer = new PerimeterX(pxConfiguration); 12 13 // Inside the request / Filter 14 @Override 15 protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOExcption { 16 ... 17 PXContext ctx = enforcer.pxVerify(req, new HttpServletResponseWrapper(resp); 18 if (ctx != null && !ctx.isHandledResponse()) { 19 // request should be blocked and BlockHandler was triggered on HttpServerResponseWrapper 20 } 21 ... 22 }
The configurations available on the SDK can be found in the Directives page.