Strangle old inspector methods
Fixes gh-81
This commit is contained in:
@@ -113,7 +113,7 @@ public class FunctionController {
|
||||
|
||||
private Mono<?> value(Function<Flux<?>, Flux<?>> function,
|
||||
@PathVariable String value) {
|
||||
Object input = inspector.convert(inspector.getName(function), value);
|
||||
Object input = inspector.convert(function, value);
|
||||
Mono<?> result = Mono.from(function.apply(Flux.just(input)));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Handled GET with function");
|
||||
|
||||
@@ -23,6 +23,7 @@ public abstract class DelegateHandler<T> {
|
||||
|
||||
private final ListableBeanFactory factory;
|
||||
private FunctionInspector processor;
|
||||
private Object handler;
|
||||
private final Object source;
|
||||
|
||||
public DelegateHandler(ListableBeanFactory factory, Object source) {
|
||||
@@ -31,9 +32,15 @@ public abstract class DelegateHandler<T> {
|
||||
}
|
||||
|
||||
public Class<?> type() {
|
||||
String name = source instanceof String ? (String) source
|
||||
: processor().getName(source);
|
||||
return (Class<?>) processor().getInputType(name);
|
||||
return processor().getInputType(handler());
|
||||
}
|
||||
|
||||
private Object handler() {
|
||||
if (handler == null) {
|
||||
handler = source instanceof String ? factory.getBean((String) source)
|
||||
: source;
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
private FunctionInspector processor() {
|
||||
|
||||
@@ -77,11 +77,11 @@ public class FluxHandlerMethodArgumentResolver
|
||||
WebDataBinderFactory binderFactory) throws Exception {
|
||||
Object handler = webRequest.getAttribute(WebRequestConstants.HANDLER,
|
||||
NativeWebRequest.SCOPE_REQUEST);
|
||||
Class<?> type = inspector.getInputType(inspector.getName(handler));
|
||||
Class<?> type = inspector.getInputType(handler);
|
||||
if (type == null) {
|
||||
type = Object.class;
|
||||
}
|
||||
boolean message = inspector.isMessage(inspector.getName(handler));
|
||||
boolean message = inspector.isMessage(handler);
|
||||
List<Object> body;
|
||||
ContentCachingRequestWrapper nativeRequest = new ContentCachingRequestWrapper(
|
||||
webRequest.getNativeRequest(HttpServletRequest.class));
|
||||
@@ -107,8 +107,8 @@ public class FluxHandlerMethodArgumentResolver
|
||||
if (message) {
|
||||
List<Object> messages = new ArrayList<>();
|
||||
for (Object payload : body) {
|
||||
messages.add(MessageBuilder.withPayload(payload).copyHeaders(
|
||||
HeaderUtils.fromHttp(new ServletServerHttpRequest(
|
||||
messages.add(MessageBuilder.withPayload(payload)
|
||||
.copyHeaders(HeaderUtils.fromHttp(new ServletServerHttpRequest(
|
||||
webRequest.getNativeRequest(HttpServletRequest.class))
|
||||
.getHeaders()))
|
||||
.build());
|
||||
|
||||
@@ -150,7 +150,7 @@ public class FluxReturnValueHandler implements AsyncHandlerMethodReturnValueHand
|
||||
|
||||
Object handler = webRequest.getAttribute(WebRequestConstants.HANDLER,
|
||||
NativeWebRequest.SCOPE_REQUEST);
|
||||
Class<?> type = inspector.getOutputType(inspector.getName(handler));
|
||||
Class<?> type = inspector.getOutputType(handler);
|
||||
|
||||
boolean inputSingle = isInputSingle(webRequest, handler);
|
||||
if (inputSingle && isOutputSingle(handler)) {
|
||||
@@ -206,9 +206,8 @@ public class FluxReturnValueHandler implements AsyncHandlerMethodReturnValueHand
|
||||
}
|
||||
|
||||
private boolean isOutputSingle(Object handler) {
|
||||
String name = inspector.getName(handler);
|
||||
Class<?> type = inspector.getOutputType(name);
|
||||
Class<?> wrapper = inspector.getOutputWrapper(name);
|
||||
Class<?> type = inspector.getOutputType(handler);
|
||||
Class<?> wrapper = inspector.getOutputWrapper(handler);
|
||||
if (Stream.class.isAssignableFrom(type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user