Deprecate adapter classes for async interceptors
This commit is contained in:
@@ -26,7 +26,7 @@ import org.springframework.orm.hibernate5.SessionFactoryUtils;
|
||||
import org.springframework.orm.hibernate5.SessionHolder;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptor;
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.web.context.request.async.DeferredResultProcessingInt
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.2
|
||||
*/
|
||||
class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter implements DeferredResultProcessingInterceptor {
|
||||
class AsyncRequestInterceptor implements CallableProcessingInterceptor, DeferredResultProcessingInterceptor {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
|
||||
|
||||
@@ -103,18 +103,6 @@ class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter imple
|
||||
|
||||
// Implementation of DeferredResultProcessingInterceptor methods
|
||||
|
||||
@Override
|
||||
public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
this.timeoutInProgress = true;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.orm.jpa.EntityManagerFactoryUtils;
|
||||
import org.springframework.orm.jpa.EntityManagerHolder;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptor;
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.web.context.request.async.DeferredResultProcessingInt
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.2.5
|
||||
*/
|
||||
class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter implements DeferredResultProcessingInterceptor {
|
||||
class AsyncRequestInterceptor implements CallableProcessingInterceptor, DeferredResultProcessingInterceptor {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
|
||||
|
||||
@@ -103,18 +103,6 @@ class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter imple
|
||||
|
||||
// Implementation of DeferredResultProcessingInterceptor methods
|
||||
|
||||
@Override
|
||||
public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult) {
|
||||
this.timeoutInProgress = true;
|
||||
|
||||
@@ -26,9 +26,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.WebAsyncManager;
|
||||
import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
@@ -68,13 +68,13 @@ final class TestDispatcherServlet extends DispatcherServlet {
|
||||
|
||||
private void registerAsyncResultInterceptors(final HttpServletRequest request) {
|
||||
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
|
||||
asyncManager.registerCallableInterceptor(KEY, new CallableProcessingInterceptorAdapter() {
|
||||
asyncManager.registerCallableInterceptor(KEY, new CallableProcessingInterceptor() {
|
||||
@Override
|
||||
public <T> void postProcess(NativeWebRequest r, Callable<T> task, Object value) throws Exception {
|
||||
getMvcResult(request).setAsyncResult(value);
|
||||
}
|
||||
});
|
||||
asyncManager.registerDeferredResultInterceptor(KEY, new DeferredResultProcessingInterceptorAdapter() {
|
||||
asyncManager.registerDeferredResultInterceptor(KEY, new DeferredResultProcessingInterceptor() {
|
||||
@Override
|
||||
public <T> void postProcess(NativeWebRequest r, DeferredResult<T> result, Object value) throws Exception {
|
||||
getMvcResult(request).setAsyncResult(value);
|
||||
|
||||
@@ -45,9 +45,9 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
*/
|
||||
public interface CallableProcessingInterceptor {
|
||||
|
||||
static final Object RESULT_NONE = new Object();
|
||||
Object RESULT_NONE = new Object();
|
||||
|
||||
static final Object RESPONSE_HANDLED = new Object();
|
||||
Object RESPONSE_HANDLED = new Object();
|
||||
|
||||
/**
|
||||
* Invoked <em>before</em> the start of concurrent handling in the original
|
||||
@@ -62,7 +62,8 @@ public interface CallableProcessingInterceptor {
|
||||
* @param task the task for the current async request
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> void beforeConcurrentHandling(NativeWebRequest request, Callable<T> task) throws Exception;
|
||||
default <T> void beforeConcurrentHandling(NativeWebRequest request, Callable<T> task) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked <em>after</em> the start of concurrent handling in the async
|
||||
@@ -72,7 +73,8 @@ public interface CallableProcessingInterceptor {
|
||||
* @param task the task for the current async request
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> void preProcess(NativeWebRequest request, Callable<T> task) throws Exception;
|
||||
default <T> void preProcess(NativeWebRequest request, Callable<T> task) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked <em>after</em> the {@code Callable} has produced a result in the
|
||||
@@ -85,7 +87,9 @@ public interface CallableProcessingInterceptor {
|
||||
* be a {@link Throwable} if the {@code Callable} raised an exception
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> void postProcess(NativeWebRequest request, Callable<T> task, Object concurrentResult) throws Exception;
|
||||
default <T> void postProcess(NativeWebRequest request, Callable<T> task,
|
||||
Object concurrentResult) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from a container thread when the async request times out before
|
||||
@@ -99,7 +103,9 @@ public interface CallableProcessingInterceptor {
|
||||
* is resumed and subsequent interceptors are not invoked
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception;
|
||||
default <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception {
|
||||
return RESULT_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from a container thread when an error occurred while processing
|
||||
@@ -115,7 +121,9 @@ public interface CallableProcessingInterceptor {
|
||||
* @throws Exception in case of errors
|
||||
* @since 5.0
|
||||
*/
|
||||
<T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception;
|
||||
default <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception {
|
||||
return RESULT_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from a container thread when async processing completes for any
|
||||
@@ -124,6 +132,7 @@ public interface CallableProcessingInterceptor {
|
||||
* @param task the task for the current async request
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> void afterCompletion(NativeWebRequest request, Callable<T> task) throws Exception;
|
||||
default <T> void afterCompletion(NativeWebRequest request, Callable<T> task) throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Rob Winch
|
||||
* @since 3.2
|
||||
* @deprecated as of 5.0 where CallableProcessingInterceptor has default methods
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class CallableProcessingInterceptorAdapter implements CallableProcessingInterceptor {
|
||||
|
||||
/**
|
||||
|
||||
@@ -268,7 +268,7 @@ public class DeferredResult<T> {
|
||||
|
||||
|
||||
final DeferredResultProcessingInterceptor getInterceptor() {
|
||||
return new DeferredResultProcessingInterceptorAdapter() {
|
||||
return new DeferredResultProcessingInterceptor() {
|
||||
@Override
|
||||
public <S> boolean handleTimeout(NativeWebRequest request, DeferredResult<S> deferredResult) {
|
||||
boolean continueProcessing = true;
|
||||
|
||||
@@ -50,7 +50,9 @@ public interface DeferredResultProcessingInterceptor {
|
||||
* @param deferredResult the DeferredResult for the current request
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) throws Exception;
|
||||
default <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult)
|
||||
throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked immediately after the start of concurrent handling, in the same
|
||||
@@ -62,7 +64,9 @@ public interface DeferredResultProcessingInterceptor {
|
||||
* @param deferredResult the DeferredResult for the current request
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) throws Exception;
|
||||
default <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult)
|
||||
throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked after a {@code DeferredResult} has been set, via
|
||||
@@ -77,7 +81,9 @@ public interface DeferredResultProcessingInterceptor {
|
||||
* @param concurrentResult the result to which the {@code DeferredResult}
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object concurrentResult) throws Exception;
|
||||
default <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult,
|
||||
Object concurrentResult) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from a container thread when an async request times out before
|
||||
@@ -92,7 +98,11 @@ public interface DeferredResultProcessingInterceptor {
|
||||
* other interceptors should not be invoked
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult) throws Exception;
|
||||
default <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult)
|
||||
throws Exception {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from a container thread when an error occurred while processing an async request
|
||||
@@ -108,7 +118,11 @@ public interface DeferredResultProcessingInterceptor {
|
||||
* other interceptors should not be invoked
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> boolean handleError(NativeWebRequest request, DeferredResult<T> deferredResult, Throwable t) throws Exception;
|
||||
default <T> boolean handleError(NativeWebRequest request, DeferredResult<T> deferredResult,
|
||||
Throwable t) throws Exception {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked from a container thread when an async request completed for any
|
||||
@@ -118,6 +132,8 @@ public interface DeferredResultProcessingInterceptor {
|
||||
* @param deferredResult the DeferredResult for the current request
|
||||
* @throws Exception in case of errors
|
||||
*/
|
||||
<T> void afterCompletion(NativeWebRequest request, DeferredResult<T> deferredResult) throws Exception;
|
||||
default <T> void afterCompletion(NativeWebRequest request, DeferredResult<T> deferredResult)
|
||||
throws Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Rob Winch
|
||||
* @since 3.2
|
||||
* @deprecated as of 5.0 where DeferredResultProcessingInterceptor has default methods
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class DeferredResultProcessingInterceptorAdapter implements DeferredResultProcessingInterceptor {
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
* @author Violeta Georgieva
|
||||
* @since 5.0
|
||||
*/
|
||||
class ErrorCallableProcessingInterceptor extends CallableProcessingInterceptorAdapter {
|
||||
class ErrorCallableProcessingInterceptor implements CallableProcessingInterceptor {
|
||||
|
||||
@Override
|
||||
public <T> Object handleError(NativeWebRequest request, Callable<T> task, Throwable t) throws Exception {
|
||||
|
||||
@@ -25,11 +25,12 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
* @author Violeta Georgieva
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ErrorDeferredResultProcessingInterceptor extends DeferredResultProcessingInterceptorAdapter {
|
||||
public class ErrorDeferredResultProcessingInterceptor implements DeferredResultProcessingInterceptor {
|
||||
|
||||
@Override
|
||||
public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> result, Throwable t)
|
||||
throws Exception {
|
||||
|
||||
result.setErrorResult(t);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.2
|
||||
*/
|
||||
public class TimeoutCallableProcessingInterceptor extends CallableProcessingInterceptorAdapter {
|
||||
public class TimeoutCallableProcessingInterceptor implements CallableProcessingInterceptor {
|
||||
|
||||
@Override
|
||||
public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception {
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.2
|
||||
*/
|
||||
public class TimeoutDeferredResultProcessingInterceptor extends DeferredResultProcessingInterceptorAdapter {
|
||||
public class TimeoutDeferredResultProcessingInterceptor implements DeferredResultProcessingInterceptor {
|
||||
|
||||
@Override
|
||||
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> result) throws Exception {
|
||||
|
||||
@@ -176,7 +176,7 @@ public class WebAsyncTask<V> implements BeanFactoryAware {
|
||||
}
|
||||
|
||||
CallableProcessingInterceptor getInterceptor() {
|
||||
return new CallableProcessingInterceptorAdapter() {
|
||||
return new CallableProcessingInterceptor() {
|
||||
@Override
|
||||
public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception {
|
||||
return (timeoutCallback != null ? timeoutCallback.call() : CallableProcessingInterceptor.RESULT_NONE);
|
||||
|
||||
@@ -18,20 +18,23 @@ package org.springframework.web.context.request.async;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.servlet.AsyncEvent;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.mock.web.test.MockAsyncContext;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
import static org.springframework.web.context.request.async.CallableProcessingInterceptor.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.mock;
|
||||
import static org.mockito.BDDMockito.verify;
|
||||
import static org.springframework.web.context.request.async.CallableProcessingInterceptor.RESULT_NONE;
|
||||
|
||||
/**
|
||||
* {@link WebAsyncManager} tests where container-triggered error/completion
|
||||
@@ -222,7 +225,7 @@ public class WebAsyncManagerErrorTests {
|
||||
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter() {
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptor() {
|
||||
@Override
|
||||
public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> result, Throwable t)
|
||||
throws Exception {
|
||||
@@ -249,7 +252,7 @@ public class WebAsyncManagerErrorTests {
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
final Exception exception = new Exception();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter() {
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptor() {
|
||||
@Override
|
||||
public <T> boolean handleError(NativeWebRequest request, DeferredResult<T> result, Throwable t)
|
||||
throws Exception {
|
||||
|
||||
@@ -28,9 +28,12 @@ import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.test.MockHttpServletResponse;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.BDDMockito.*;
|
||||
import static org.springframework.web.context.request.async.CallableProcessingInterceptor.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.mock;
|
||||
import static org.mockito.BDDMockito.verify;
|
||||
import static org.springframework.web.context.request.async.CallableProcessingInterceptor.RESULT_NONE;
|
||||
|
||||
/**
|
||||
* {@link WebAsyncManager} tests where container-triggered timeout/completion
|
||||
@@ -210,7 +213,7 @@ public class WebAsyncManagerTimeoutTests {
|
||||
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter() {
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptor() {
|
||||
@Override
|
||||
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> result) throws Exception {
|
||||
result.setErrorResult(23);
|
||||
@@ -235,7 +238,7 @@ public class WebAsyncManagerTimeoutTests {
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
final Exception exception = new Exception();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter() {
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptor() {
|
||||
@Override
|
||||
public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> result) throws Exception {
|
||||
throw exception;
|
||||
|
||||
@@ -55,7 +55,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.WebAsyncManager;
|
||||
import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
import org.springframework.web.context.support.ServletRequestHandledEvent;
|
||||
@@ -1126,7 +1126,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
|
||||
* CallableProcessingInterceptor implementation that initializes and resets
|
||||
* FrameworkServlet's context holders, i.e. LocaleContextHolder and RequestContextHolder.
|
||||
*/
|
||||
private class RequestBindingInterceptor extends CallableProcessingInterceptorAdapter {
|
||||
private class RequestBindingInterceptor implements CallableProcessingInterceptor {
|
||||
|
||||
@Override
|
||||
public <T> void preProcess(NativeWebRequest webRequest, Callable<T> task) {
|
||||
|
||||
@@ -84,9 +84,7 @@ import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.ServletWebRequest;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
@@ -143,8 +141,16 @@ import org.springframework.web.servlet.view.tiles3.TilesConfigurer;
|
||||
import org.springframework.web.servlet.view.tiles3.TilesViewResolver;
|
||||
import org.springframework.web.util.UrlPathHelper;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Tests loading actual MVC namespace configuration.
|
||||
@@ -1029,11 +1035,11 @@ public class MvcNamespaceTests {
|
||||
}
|
||||
|
||||
|
||||
public static class TestCallableProcessingInterceptor extends CallableProcessingInterceptorAdapter {
|
||||
public static class TestCallableProcessingInterceptor implements CallableProcessingInterceptor {
|
||||
}
|
||||
|
||||
|
||||
public static class TestDeferredResultProcessingInterceptor extends DeferredResultProcessingInterceptorAdapter {
|
||||
public static class TestDeferredResultProcessingInterceptor implements DeferredResultProcessingInterceptor {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -54,9 +53,7 @@ import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.context.request.ServletWebRequest;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptor;
|
||||
import org.springframework.web.context.request.async.DeferredResultProcessingInterceptorAdapter;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.method.annotation.ModelAttributeMethodProcessor;
|
||||
@@ -373,8 +370,8 @@ public class WebMvcConfigurationSupportExtensionTests {
|
||||
@Override
|
||||
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
|
||||
configurer.setDefaultTimeout(2500).setTaskExecutor(new ConcurrentTaskExecutor())
|
||||
.registerCallableInterceptors(new CallableProcessingInterceptorAdapter() { })
|
||||
.registerDeferredResultInterceptors(new DeferredResultProcessingInterceptorAdapter() {});
|
||||
.registerCallableInterceptors(new CallableProcessingInterceptor() { })
|
||||
.registerDeferredResultInterceptors(new DeferredResultProcessingInterceptor() {});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user