code: public void handle(String pathInContext, String pathParams, HttpRequest request,
              HttpResponse response) throws HttpException, IOException
      {
  
          // exempt error pages
          // TODO This probably should be more general?
          if (request.getAttribute("javax.servlet.error.status_code") != null) return;
  
          try
          {
  
              String ip = request.getRemoteAddr();
              boolean authorized = checkIP(ip);
  
              if (!authorized)
              {
                  // The IP is NOT allowed
                  response.sendError(HttpResponse.__403_Forbidden);
                  request.setHandled(true);
                  return;
              }
              else
              {
                  // The IP is allowed
                  return;
              }
          }
          catch (Exception ex)
          {
              System.out.println(ex);
              response.sendError(HttpResponse.__500_Internal_Server_Error);
              request.setHandled(true);
          }
      }
docs: Handles the incoming request
  
  @param pathInContext
  @param pathParams
  @param request The incoming HTTP-request
  @param response The outgoing HTTP-response