Spring Framework CallableProcessingInterceptorAdapter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework CallableProcessingInterceptorAdapter class.

This code example shows how to use the following methods:
 
    /** 
     * Create a new {@link SecurityContextCallableProcessingInterceptor} that uses the {@link SecurityContext} from the 
     * {@link SecurityContextHolder} at the time {@link #beforeConcurrentHandling(NativeWebRequest, Callable)} is invoked. 
     */ 
    public SecurityContextCallableProcessingInterceptor() { 
    } 
 
    /** 
     * Creates a new {@link SecurityContextCallableProcessingInterceptor} with the specified {@link SecurityContext}. 
     * @param securityContext the {@link SecurityContext} to set on the {@link SecurityContextHolder} in 
     * {@link #preProcess(NativeWebRequest, Callable)}. Cannot be null. 
     * @throws IllegalArgumentException if {@link SecurityContext} is null. 
     */ 
    public SecurityContextCallableProcessingInterceptor(SecurityContext securityContext) {
        Assert.notNull(securityContext, "securityContext cannot be null");
        setSecurityContext(securityContext);
    } 
 
    @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
/** 
 * <p>User: Zhang Kaitao 
 * <p>Date: 13-7-18 下午8:23 
 * <p>Version: 1.0 
 */ 
public class MyCallableInterceptor extends CallableProcessingInterceptorAdapter {
 
    @Override 
    public <T> void beforeConcurrentHandling(final NativeWebRequest request, final Callable<T> task) throws Exception {
        System.out.println("=====在startAsyc开启异步 和 提交异步任务到Executor 之前执行");
        //此时可以保存一些数据到异步上下文,如spring security的SecurityContextHolder或Shiro的SecurityUtils(Subject) 
    } 
 
    @Override 
    public <T> void preProcess(final NativeWebRequest request, final Callable<T> task) throws Exception {
        //此时可以把在beforeConcurrentHandling保存的那些数据绑定到这个线程上(将在一个新线程执行) 
        System.out.println("在Callable.call运行之前执行");
    } 
 
    @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
import static spring.trace.web.SpringTraceWebConstant.*; 
 
/** 
 * @author: holyeye 
 */ 
public class TraceAsyncRequestInterceptor extends CallableProcessingInterceptorAdapter
        implements DeferredResultProcessingInterceptor {
 
    private static Logger log = LoggerFactory.getLogger(TraceAsyncRequestInterceptor.class); 
 
    @Override 
    public <T> void beforeConcurrentHandling(NativeWebRequest request, Callable<T> task) throws Exception {
        TraceLogInfoThreadLocalManager.clear(); 
    } 
 
    @Override 
    public <T> void preProcess(NativeWebRequest request, Callable<T> task) {
        TraceLogInfo traceLogInfo = (TraceLogInfo) request.getAttribute(LOG_INFO_ATTRIBUTE_NAME, NativeWebRequest.SCOPE_REQUEST);
        TraceLogInfoThreadLocalManager.bindTraceLogInfo(traceLogInfo);
    } 
4
CodeRank
Experience pair programming with AI  Get Codota for Java