/** * Create a {@link ServletInvocableHandlerMethod} from the given {@link HandlerMethod} definition. * @param handlerMethod the {@link HandlerMethod} definition * @return the corresponding {@link ServletInvocableHandlerMethod} (or custom subclass thereof) * @since 4.2 */ protected ServletInvocableHandlerMethod createInvocableHandlerMethod(HandlerMethod handlerMethod) { return new ServletInvocableHandlerMethod(handlerMethod); }
/** * Create a {@link ServletInvocableHandlerMethod} from the given {@link HandlerMethod} definition. * @param handlerMethod the {@link HandlerMethod} definition * @return the corresponding {@link ServletInvocableHandlerMethod} (or custom subclass thereof) * @since 4.2 */ protected ServletInvocableHandlerMethod createInvocableHandlerMethod(HandlerMethod handlerMethod) { return new ServletInvocableHandlerMethod(handlerMethod); }
return new ServletInvocableHandlerMethod(handlerMethod.getBean(), method); Method method = resolver.resolveMethod(exception); if (method != null) { return new ServletInvocableHandlerMethod(advice.resolveBean(), method);
private ServletInvocableHandlerMethod getHandlerMethod(Object controller, String methodName, Class<?>... argTypes) throws NoSuchMethodException { Method method = controller.getClass().getDeclaredMethod(methodName, argTypes); ServletInvocableHandlerMethod handlerMethod = new ServletInvocableHandlerMethod(controller, method); handlerMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers); handlerMethod.setHandlerMethodReturnValueHandlers(this.returnValueHandlers); return handlerMethod; }
return new ServletInvocableHandlerMethod(handlerMethod.getBean(), method); Method method = resolver.resolveMethod(exception); if (method != null) { return new ServletInvocableHandlerMethod(advice.resolveBean(), method);
/** * Create a {@link ServletInvocableHandlerMethod} from the given {@link HandlerMethod} * definition. * * @param handlerMethod the {@link HandlerMethod} definition * @return the corresponding {@link ServletInvocableHandlerMethod} (or custom subclass thereof) * @since 4.2 */ protected ServletInvocableHandlerMethod createInvocableHandlerMethod( HandlerMethod handlerMethod) { return new ServletInvocableHandlerMethod(handlerMethod); }
/** * Factory method used to create a {@link ServletInvocableHandlerMethod}. * @param handler the handler * @param method the navigation mapping method to invoke * @return a new {@link ServletInvocableHandlerMethod} instance */ protected ServletInvocableHandlerMethod createInvocableNavigationMethod(Object handler, Method method) { return new ServletInvocableHandlerMethod(handler, method); }
/** * Create a {@link ServletInvocableHandlerMethod} from the given {@link HandlerMethod} definition. * @param handlerMethod the {@link HandlerMethod} definition * @return the corresponding {@link ServletInvocableHandlerMethod} (or custom subclass thereof) * @since 4.2 */ protected ServletInvocableHandlerMethod createInvocableHandlerMethod(HandlerMethod handlerMethod) { return new ServletInvocableHandlerMethod(handlerMethod); }
@Override protected ServletInvocableHandlerMethod getExceptionHandlerMethod(final HandlerMethod handlerMethod, final Exception exception) { if (((InvocationException) exception).getStatusCode() == HttpStatus.BAD_REQUEST.value()) { Method method = new ExceptionHandlerMethodResolver(BadRequestExceptionAdvice.class).resolveMethod(exception); return new ServletInvocableHandlerMethod(new BadRequestExceptionAdvice(), method); } else if (((InvocationException) exception).getStatusCode() == HttpStatus.TOO_MANY_REQUESTS.value()) { Method method = new ExceptionHandlerMethodResolver(TooManyRequestsExceptionAdvice.class).resolveMethod(exception); return new ServletInvocableHandlerMethod(new TooManyRequestsExceptionAdvice(), method); } return super.getExceptionHandlerMethod(handlerMethod, exception); } }
@Override protected ServletInvocableHandlerMethod getExceptionHandlerMethod(HandlerMethod handlerMethod, Exception exception) { Method method = new ExceptionHandlerMethodResolver(RestExceptionHandler.class).resolveMethod(exception); RestExceptionHandler validationHandler = new RestExceptionHandler(); validationHandler.setMessageSource(messageSource); return new ServletInvocableHandlerMethod(validationHandler, method); } };