Example usage for org.springframework.web.servlet.mvc.method.annotation ServletInvocableHandlerMethod ServletInvocableHandlerMethod

List of usage examples for org.springframework.web.servlet.mvc.method.annotation ServletInvocableHandlerMethod ServletInvocableHandlerMethod

Introduction

In this page you can find the example usage for org.springframework.web.servlet.mvc.method.annotation ServletInvocableHandlerMethod ServletInvocableHandlerMethod.

Prototype

public ServletInvocableHandlerMethod(Object handler, Method method) 

Source Link

Document

Creates an instance from the given handler and method.

Usage

From source file:od.controller.tests.ControllerTests.java

protected ExceptionHandlerExceptionResolver createExceptionResolver() {
    ExceptionHandlerExceptionResolver exceptionResolver = new ExceptionHandlerExceptionResolver() {
        @Override/*from w w w  . j a  va  2 s  . c o  m*/
        protected ServletInvocableHandlerMethod getExceptionHandlerMethod(HandlerMethod handlerMethod,
                Exception exception) {
            Method method = new ExceptionHandlerMethodResolver(AppControllerAdvice.class)
                    .resolveMethod(exception);
            return new ServletInvocableHandlerMethod(new AppControllerAdvice(), method);
        }
    };
    exceptionResolver.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
    exceptionResolver.afterPropertiesSet();
    return exceptionResolver;
}

From source file:org.exoplatform.acceptance.rest.administration.credential.CredentialCRUDControllerTest.java

private ExceptionHandlerExceptionResolver createExceptionResolver() {
    ExceptionHandlerExceptionResolver exceptionResolver = new ExceptionHandlerExceptionResolver() {
        protected ServletInvocableHandlerMethod getExceptionHandlerMethod(HandlerMethod handlerMethod,
                Exception exception) {
            Method method = new ExceptionHandlerMethodResolver(JsonErrorHandler.class).resolveMethod(exception);
            return new ServletInvocableHandlerMethod(jsonErrorHandler, method);
        }/*from   w  w w. j a  va2s . c o  m*/
    };
    List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
    messageConverters.add(new FormHttpMessageConverter());
    messageConverters.add(new StringHttpMessageConverter());
    messageConverters.add(new MappingJackson2HttpMessageConverter());
    exceptionResolver.setMessageConverters(messageConverters);
    exceptionResolver.afterPropertiesSet();
    return exceptionResolver;
}