TODO implement interceptors to admin page
320567
public void setAdminPage(String url, String docPath, List<Interceptor> interceptors) {
        adminPage = HandlerUtil.staticFiles(url, docPath);
    }
985652
void asyncUpdate() {

        CmsRpcAction<Boolean> action = new CmsRpcAction<Boolean>() {

            @Override
            public void execute() {

                start(200, false);
                m_controller.getContainerpageService().checkContainerpageOrElementsChanged(
                    CmsCoreProvider.get().getStructureId(),
                    CmsContainerpageController.get().getData().getDetailId(),
                    CmsContainerpageController.get().getData().getLocale(),
                    this);
            }

            @Override
            protected void onResponse(Boolean result) {

                stop(false);
                boolean changed = result.booleanValue();
                setChanged(changed);
            }

        };
        action.execute();
    }
173641
function checkPostOrPutOrPatchRequest(req, res, cb) {
            var _keys;
            var _reqElement;

            if (req.body) {
                _keys = Object.keys(req.body);
                _keys.forEach(function (keyElement) {
                    _reqElement = req.body[keyElement];
                    //console.log(/" [a-z]*="/i.spec(_reqElement));
                    _patterns.forEach(function (pattern) {
                        if (pattern.test(_reqElement) && _blocker.blockHost) {
                            _config.attack.handle(req, res);
                        }
                    });
                });
            }
            if (cb) {
                cb();
            }
        }
504008
function (interfaceMethods, interceptor, allInterceptors) {
        var interceptedMethods = allInterceptors || {};
        // for a class object, intercept specific methods
        for (var m in interfaceMethods) {
            if (interfaceMethods.hasOwnProperty(m) && __hasBeenIntercepted(m, interceptor)) {
                (interceptedMethods[m] || (interceptedMethods[m] = [])).push({
                    fn : __callInterceptorMethod,
                    scope : interceptor
                });
            }
        }
        return interceptedMethods;
    }
1177116
public void initConstructorDeclaredEjbInterceptors() {
        Class<?>[] constructorDeclaredInterceptors = interceptorsApi.extractInterceptorClasses(constructor);
        if (constructorDeclaredInterceptors != null) {
            for (Class<?> clazz : constructorDeclaredInterceptors) {
                builder.interceptGlobal(InterceptionType.AROUND_CONSTRUCT, null, Collections.<InterceptorClassMetadata<?>>singleton(reader.getPlainInterceptorMetadata(clazz)), null);
            }
        }
    }
1158916
public void executeAround(Object interceptor, Method method) {
		if (method != null) {
			Object[] params = parametersResolver.parametersFor(method);
			stepInvoker.tryToInvoke(interceptor, method, params);
		} else {
			simpleInterceptorStack.get().next();
		}
	}
1260737
public function bind(AbstractAdmin $admin, Request $request)
    {
        if ($this->request) {
            throw new \RuntimeException('A datagrid can only be bound once to a request');
        }

        // configure our datagrid
        $resolver = new OptionsResolver();
        $this->configureOptions($resolver);
        $this->options = $resolver->resolve($admin->getDatagridOptions());

        $this->admin = $admin;
        $this->request = $request;

        // attach our fields, filters and actions
        $this->admin->buildDatagrid($this);

        $this->applyFilters();
    }
855384
def apply_interceptors(work_db, enabled_interceptors):
    """"""
    names = (name for name in interceptor_names() if name in enabled_interceptors)
    for name in names:
        interceptor = get_interceptor(name)
        interceptor(work_db)
8754
function interceptPropertyGet(_ref7) {
  var _this2 = this;

  var entity = _ref7.entity,
      properties = _ref7.properties;

  // Create a proxy .interceptPropertyGet(...) methods, per property
  this.interceptPropertyGet = _lodash2.default.reduce(properties, function (interceptPropertyGet, propertyConfiguration, propertyName) {

    // Fetch extensions implementing .interceptPropertyGet(...) method for this property's interceptor functions
    var getterInterceptors = _lodash2.default.compact(_lodash2.default.map(_this2.extensions, function (extension) {
      // Check if implementing .interceptPropertyGet(...) method
      if (extension.implemented.interceptPropertyGet) {
        // Return the setter interceptor function (if returned for this property)
        return extension.interceptPropertyGet(propertyName, propertyConfiguration);
      }
    }));

    // Initialize a per-property setter intercepting function and returns the updated value
    interceptPropertyGet[propertyName] = function (currentValue, newValue) {

      // Initialize the EnTTExtValueEvent event
      var changes = [currentValue, newValue],
          event = new _enttext.EnTTExtValueEvent({
        changes: changes,
        currentValue: currentValue,
        value: newValue
      });

      // Cycle through all the setter interceptors
      _lodash2.default.forEach(getterInterceptors, function (getterInterceptor) {
        // Execute the extensino intercaptor
        getterInterceptor(entity, properties, event);
        // Update the changes array for the next interceptor
        changes.push(event.value);
      });

      // Return the updated value
      return event.value;
    };

    // Return composed interceptors
    return interceptPropertyGet;
  }, {});
}
447563
public void invoke() throws ActionException {
		Integer position = interceptorPosition.get();
		if (position == null) {
			position = 0;
		}

		if (interceptors != null && position < interceptors.length) {
			//执行过滤器，递归调用本方法
			interceptorPosition.set(position + 1);
			interceptors[position].invoke(this);
		}else {
			//过滤器执行完毕，执行本体方法
			invokeActionMethod();
			// 执行了Action本体方法，说明过滤器使用完毕，清理游标防止重复执行
			resetInterceptorPosition();
		}
	}
1145701
@SuppressWarnings("unchecked")
    @Override
    public final void enforce(String subjectId,
                              String action,
                              String api,
                              String pid,
                              String namespace,
                              Context context) throws AuthzException {

        boolean debug = logger.isDebugEnabled();
        long enforceStartTime = debug ? System.currentTimeMillis() : 0;
        try {
            synchronized (this) {
                //wait, if pdp update is in progress
            }
            if (ENFORCE_MODE_PERMIT_ALL_REQUESTS.equals(m_enforceMode)) {
                logger.debug("permitting request because enforceMode==ENFORCE_MODE_PERMIT_ALL_REQUESTS");
            } else if (ENFORCE_MODE_DENY_ALL_REQUESTS.equals(m_enforceMode)) {
                logger.debug("denying request because enforceMode==ENFORCE_MODE_DENY_ALL_REQUESTS");
                throw new AuthzDeniedException("all requests are currently denied");
            } else if (!ENFORCE_MODE_ENFORCE_POLICIES.equals(m_enforceMode)) {
                logger.debug("denying request because enforceMode is invalid");
                throw new AuthzOperationalException("invalid enforceMode from config \"" + m_enforceMode + "\"");
            } else {
                ResponseCtx response = null;
                String contextIndex = null;
                try {
                    contextIndex = Integer.toString(next());
                    logger.debug("context index set={}", contextIndex);
                    List<Subject> subjects = wrapSubjects(subjectId);
                    List<Attribute> actions = wrapActions(action, api, contextIndex);
                    List<Attribute> resources = wrapResources(pid, namespace);

                    RequestCtx request =
                            new BasicRequestCtx(subjects,
                                           resources,
                                           actions,
                                           EMPTY_ENV);
                    if (debug) {
                        for (Attribute tempobj: actions) {
                            logger.debug("request action has {}={}", tempobj.getId(), tempobj.getValue());
                        }
                    }
                    m_registry.registerContext(contextIndex, context);
                    long st = debug ? System.currentTimeMillis() : 0;
                    try {
                        // we use a localized EvaluationCtx so that resource-id is correctly located
                        response = m_pdp.evaluate(new BasicEvaluationCtx(request, m_pdpConfig.getAttributeFinder()));
                    } finally {
                        if (debug) {
                          long dur = System.currentTimeMillis() - st;
                          logger.debug("Policy evaluation took {} ms.", dur);
                        }
                    }

                    logger.debug("in pep, after evaluate() called");
                } catch (Throwable t) {
                    logger.error("Error evaluating policy", t);
                    throw new AuthzOperationalException("");
                } finally {
                    m_registry.unregisterContext(contextIndex);
                }
                logger.debug("in pep, before denyBiasedAuthz() called");
                if (!denyBiasedAuthz(response.getResults())) {
                    if (debug) {
                        ByteArrayOutputStream bos = new ByteArrayOutputStream();
                        response.encode(bos);                        
                        logger.debug(bos.toString());                        
                    }
                    throw new AuthzDeniedException("");
                }
            }
            if (context.getNoOp()) {
                throw new AuthzPermittedException("noOp");
            }
        } finally {
            if (debug) {
                long dur = System.currentTimeMillis() - enforceStartTime;
                logger.debug("Policy enforcement took {} ms.", dur);
            }
        }
    }
184153
@Override
    public ClientHttpResponse intercept(
            HttpRequest req, byte[] body, ClientHttpRequestExecution execution) throws IOException {
        Assert.notNull(propertyResolver);
        Assert.notNull(id);

        try {
            String authString = getOAuthAuthString(req);
            req.getHeaders().add(Headers.Authorization.name(), authString);
        } catch (Exception e) {
            throw new IOException("Error building OAuth header", e);
        }

        return execution.execute(req, body);
    }
741006
public function onKernelController(FilterControllerEvent $event): void
    {
        $controller = $event->getController();
        if (\is_array($controller)) {
            [$controller] = $controller; // Ignoring action
        }
        if (!$controller instanceof AdminInjectableInterface && !$controller instanceof ActionInjectableInterface) {
            return;
        }

        $request = $event->getRequest();
        if (!$request->attributes->has('_admin')) {
            $routeName = $request->attributes->get('_route');

            $m = "Missing request attribute '_admin' for route {$routeName}, this means you declared";
            $m .= ' this route outside the admin configuration, please use the admin configuration';
            throw new \LogicException($m);
        }
        $admin = $request->attributes->get('_admin');
        if (!$admin instanceof Admin) {
            throw new \UnexpectedValueException('_admin request attribute is not an Admin object');
        }
        if ($controller instanceof AdminInjectableInterface) {
            $controller->setAdmin($admin);
        }

        if (!$request->attributes->has('_action')) {
            $routeName = $request->attributes->get('_route');

            $m = "Missing request attribute '_action' for route {$routeName},";
            $m .= 'this means you declared this route outside the admin configuration, please include the _action';
            $m .= 'attribute in your route definition or use the admin configuration';
            throw new \LogicException($m);
        }
        $admin->setCurrentAction($request->attributes->get('_action'));
        if ($controller instanceof ActionInjectableInterface) {
            $controller->setAction($admin->getCurrentAction());
        }
    }
848272
protected void configureHandlerInterceptor(ApplicationContext context) {
        if (context.containsBean(HANDLER_INTERCEPTOR_BEAN_NAME)) {
            DelegatingHandlerInterceptor handlerInterceptor = context.getBean(HANDLER_INTERCEPTOR_BEAN_NAME, DelegatingHandlerInterceptor.class);
            handlerInterceptor.setInterceptors(adaptInterceptors(httpServer.getInterceptors(), context));
        }
    }
649936
private void doUpdateComponent() throws PageException {

	admin.updateComponentDeepSearch(getBoolObject("admin", action, "deepSearch"));
	admin.updateBaseComponent(getString("admin", action, "baseComponentTemplateCFML"), getString("admin", action, "baseComponentTemplateLucee"));
	admin.updateComponentDumpTemplate(getString("admin", action, "componentDumpTemplate"));
	admin.updateComponentDataMemberDefaultAccess(getString("admin", action, "componentDataMemberDefaultAccess"));
	admin.updateTriggerDataMember(getBoolObject("admin", action, "triggerDataMember"));
	admin.updateComponentUseShadow(getBoolObject("admin", action, "useShadow"));
	admin.updateComponentDefaultImport(getString("admin", action, "componentDefaultImport"));
	admin.updateComponentLocalSearch(getBoolObject("admin", action, "componentLocalSearch"));
	admin.updateComponentPathCache(getBoolObject("admin", action, "componentPathCache"));
	store();
	adminSync.broadcast(attributes, config);
    }
1224365
function (interfaceMethods, interceptor, allInterceptors) {
        var interceptedMethods = allInterceptors || {};
        // for a callback, intercept all methods of an interface
        for (var i in interfaceMethods) {
            if (interfaceMethods.hasOwnProperty(i)) {
                (interceptedMethods[i] || (interceptedMethods[i] = [])).push(interceptor);
            }
        }
        return interceptedMethods;
    }
81294
def _transport_interceptor(self, callback):
        """"""

        def add_item_to_queue(header, message):
            queue_item = (
                Priority.TRANSPORT,
                next(
                    self._transport_interceptor_counter
                ),  # insertion sequence to keep messages in order
                (callback, header, message),
            )
            self.__queue.put(
                queue_item
            )  # Block incoming transport until insertion completes

        return add_item_to_queue