DATAREST-1397 - Adapt to CORS changes in AbstractHandlerMapping.

We now enable CORS handling for all requests by overriding the newly introduced hasCorsConfigurationSource method. We cannot detect CORS configuration handling solely on the handler but require path headers to resolve repository interface mappings.
This commit is contained in:
Mark Paluch
2019-06-21 11:04:53 +02:00
committed by Oliver Drotbohm
parent 436e7e1e13
commit 4e586495f4
4 changed files with 82 additions and 1 deletions

View File

@@ -112,6 +112,15 @@ public class BasePathAwareHandlerMapping extends RequestMappingHandlerMapping {
return super.lookupHandlerMethod(lookupPath, new CustomAcceptHeaderHttpServletRequest(request, mediaTypes));
}
/*
* (non-Javadoc)
* @see org.springframework.web.servlet.handler.AbstractHandlerMapping#hasCorsConfigurationSource(java.lang.Object)
*/
@Override
protected boolean hasCorsConfigurationSource(Object handler) {
return true;
}
/*
* (non-Javadoc)
* @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#getMappingForMethod(java.lang.reflect.Method, java.lang.Class)

View File

@@ -190,6 +190,15 @@ public class RepositoryRestHandlerMapping extends BasePathAwareHandlerMapping {
return AnnotationUtils.findAnnotation(type, RepositoryRestController.class) != null;
}
/*
* (non-Javadoc)
* @see org.springframework.web.servlet.handler.AbstractHandlerMapping#hasCorsConfigurationSource(java.lang.Object)
*/
@Override
protected boolean hasCorsConfigurationSource(Object handler) {
return true;
}
/*
* (non-Javadoc)
* @see org.springframework.web.servlet.handler.AbstractHandlerMapping#extendInterceptors(java.util.List)