此内容没有您所选择的语言版本。

28.2. PreProcessInterceptor


The org.jboss.resteasy.spi.interception.PreProcessInterceptor runs after a JAX-RS resource method is located, but before the method is invoked. They can only be used on the server, but you must still annotate them with @ServerInterceptor. They can be used to implement security features or to preempt the Java request. The RESTEasy security implementation uses these interceptors to abort requests prior to invocation if the user does not pass authorization. The RESTEasy caching framework uses them to return cached responses, to avoid invoking methods multiple times. The interceptor interface is as follows:
    public interface PreProcessInterceptor
    {
       ServerResponse preProcess(HttpRequest request, ResourceMethod method) throws Failure, WebApplicationException;
    }

Copy to Clipboard Toggle word wrap
PreProcessInterceptors run in sequence and do not wrap the actual JAX-RS invocation. To illustrate:
    for (PreProcessInterceptor interceptor : preProcessInterceptors) {
       ServerResponse response = interceptor.preProcess(request, method);
       if (response != null) return response;
    }
    executeJaxrsMethod(...);
Copy to Clipboard Toggle word wrap
If the preProcess() method returns a ServerResponse then the underlying JAX-RS method will not be invoked and the runtime will process the response and return to the client.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat