简体   繁体   中英

Looking for interceptors for grails service class

Is there any interceptor I can use to validate incoming requests to the Grails service classes/Endpoints? I know interceptors for controllers but I want to do it for Service/endpoint.

这听起来像你在寻找: 拦截服务方法

In the link mentioned above(Kelly's reply), interceptor logic for Service has been added in BootStrap class. That might suffice in most of the cases but not all. In case you are using Quartz scheduler then job might get triggered even before BootStrap has made required modifications.

The best place to modify a service method would be via custom plugin . You can decorate service method in doWithApplicationContext or doWithDynamicMethod available in Plugin class. These methods are triggered at first and guarantee that changes made will be available to all other classes. Please refer Grails custom plugin documentation for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM