if (this.returnValueHandlers.getReturnValueHandlers().isEmpty()) { this.returnValueHandlers.addHandlers(initReturnValueHandlers()); this.returnValueHandlers.setLogger(returnValueLogger);
/** * Configure the complete list of supported return value types, effectively overriding * the ones configured by default. This is an advanced option; for most use cases * it should be sufficient to use {@link #setCustomReturnValueHandlers}. */ public void setReturnValueHandlers(@Nullable List<HandlerMethodReturnValueHandler> returnValueHandlers) { if (returnValueHandlers == null) { this.returnValueHandlers.clear(); return; } this.returnValueHandlers.addHandlers(returnValueHandlers); }
@Override public boolean supportsReturnType(MethodParameter returnType) { return getReturnValueHandler(returnType) != null; }
return; if (returnValue != null && this.returnValueHandlers.isAsyncReturnValue(returnValue, returnType)) { ListenableFuture<?> future = this.returnValueHandlers.toListenableFuture(returnValue, returnType); if (future != null) { future.addCallback(new ReturnValueListenableFutureCallback(invocable, message)); this.returnValueHandlers.handleReturnValue(returnValue, returnType, message);
/** * Return the complete list of return value handlers. */ public List<HandlerMethodReturnValueHandler> getReturnValueHandlers() { return this.returnValueHandlers.getReturnValueHandlers(); }
protected void processHandlerMethodException(HandlerMethod handlerMethod, Exception exception, Message<?> message) { InvocableHandlerMethod invocable = getExceptionHandlerMethod(handlerMethod, exception); if (invocable == null) { logger.error("Unhandled exception from message handler method", exception); return; } invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); if (logger.isDebugEnabled()) { logger.debug("Invoking " + invocable.getShortLogMessage()); } try { Throwable cause = exception.getCause(); Object returnValue = (cause != null ? invocable.invoke(message, exception, cause, handlerMethod) : invocable.invoke(message, exception, handlerMethod)); MethodParameter returnType = invocable.getReturnType(); if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); } catch (Throwable ex2) { logger.error("Error while processing handler method exception", ex2); } }
return; if (returnValue != null && this.returnValueHandlers.isAsyncReturnValue(returnValue, returnType)) { ListenableFuture<?> future = this.returnValueHandlers.toListenableFuture(returnValue, returnType); if (future != null) { future.addCallback(new ReturnValueListenableFutureCallback(invocable, message)); this.returnValueHandlers.handleReturnValue(returnValue, returnType, message);
/** * Return the complete list of return value handlers. */ public List<HandlerMethodReturnValueHandler> getReturnValueHandlers() { return this.returnValueHandlers.getReturnValueHandlers(); }
protected void processHandlerMethodException(HandlerMethod handlerMethod, Exception exception, Message<?> message) { InvocableHandlerMethod invocable = getExceptionHandlerMethod(handlerMethod, exception); if (invocable == null) { logger.error("Unhandled exception from message handler method", exception); return; } invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); if (logger.isDebugEnabled()) { logger.debug("Invoking " + invocable.getShortLogMessage()); } try { Throwable cause = exception.getCause(); Object returnValue = (cause != null ? invocable.invoke(message, exception, cause, handlerMethod) : invocable.invoke(message, exception, handlerMethod)); MethodParameter returnType = invocable.getReturnType(); if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); } catch (Throwable ex2) { logger.error("Error while processing handler method exception", ex2); } }
return; if (returnValue != null && this.returnValueHandlers.isAsyncReturnValue(returnValue, returnType)) { ListenableFuture<?> future = this.returnValueHandlers.toListenableFuture(returnValue, returnType); if (future != null) { future.addCallback(new ReturnValueListenableFutureCallback(invocable, message)); this.returnValueHandlers.handleReturnValue(returnValue, returnType, message);
if (this.returnValueHandlers.getReturnValueHandlers().isEmpty()) { this.returnValueHandlers.addHandlers(initReturnValueHandlers()); this.returnValueHandlers.setLogger(returnValueLogger);
@Override @Nullable public ListenableFuture<?> toListenableFuture(Object returnValue, MethodParameter returnType) { HandlerMethodReturnValueHandler handler = getReturnValueHandler(returnType); Assert.state(handler instanceof AsyncHandlerMethodReturnValueHandler, "AsyncHandlerMethodReturnValueHandler required"); return ((AsyncHandlerMethodReturnValueHandler) handler).toListenableFuture(returnValue, returnType); }
/** * Configure the complete list of supported return value types, effectively overriding * the ones configured by default. This is an advanced option; for most use cases * it should be sufficient to use {@link #setCustomReturnValueHandlers}. */ public void setReturnValueHandlers(@Nullable List<HandlerMethodReturnValueHandler> returnValueHandlers) { if (returnValueHandlers == null) { this.returnValueHandlers.clear(); return; } this.returnValueHandlers.addHandlers(returnValueHandlers); }
/** * Return the complete list of return value handlers. */ public List<HandlerMethodReturnValueHandler> getReturnValueHandlers() { return this.returnValueHandlers.getReturnValueHandlers(); }
protected void processHandlerMethodException(HandlerMethod handlerMethod, Exception exception, Message<?> message) { InvocableHandlerMethod invocable = getExceptionHandlerMethod(handlerMethod, exception); if (invocable == null) { logger.error("Unhandled exception from message handler method", exception); return; } invocable.setMessageMethodArgumentResolvers(this.argumentResolvers); if (logger.isDebugEnabled()) { logger.debug("Invoking " + invocable.getShortLogMessage()); } try { Throwable cause = exception.getCause(); Object returnValue = (cause != null ? invocable.invoke(message, exception, cause, handlerMethod) : invocable.invoke(message, exception, handlerMethod)); MethodParameter returnType = invocable.getReturnType(); if (void.class == returnType.getParameterType()) { return; } this.returnValueHandlers.handleReturnValue(returnValue, returnType, message); } catch (Throwable ex2) { logger.error("Error while processing handler method exception", ex2); } }
return; if (returnValue != null && this.returnValueHandlers.isAsyncReturnValue(returnValue, returnType)) { ListenableFuture<?> future = this.returnValueHandlers.toListenableFuture(returnValue, returnType); if (future != null) { future.addCallback(new ReturnValueListenableFutureCallback(invocable, message)); this.returnValueHandlers.handleReturnValue(returnValue, returnType, message);
if (this.returnValueHandlers.getReturnValueHandlers().isEmpty()) { this.returnValueHandlers.addHandlers(initReturnValueHandlers()); this.returnValueHandlers.setLogger(returnValueLogger);
@Override public boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType) { HandlerMethodReturnValueHandler handler = getReturnValueHandler(returnType); return (handler instanceof AsyncHandlerMethodReturnValueHandler && ((AsyncHandlerMethodReturnValueHandler) handler).isAsyncReturnValue(returnValue, returnType)); }
/** * Configure the complete list of supported return value types, effectively overriding * the ones configured by default. This is an advanced option; for most use cases * it should be sufficient to use {@link #setCustomReturnValueHandlers}. */ public void setReturnValueHandlers(@Nullable List<HandlerMethodReturnValueHandler> returnValueHandlers) { if (returnValueHandlers == null) { this.returnValueHandlers.clear(); return; } this.returnValueHandlers.addHandlers(returnValueHandlers); }
/** * Return the complete list of return value handlers. */ public List<HandlerMethodReturnValueHandler> getReturnValueHandlers() { return this.returnValueHandlers.getReturnValueHandlers(); }