Example usage for org.springframework.web.servlet.handler SimpleMappingExceptionResolver setExceptionAttribute

List of usage examples for org.springframework.web.servlet.handler SimpleMappingExceptionResolver setExceptionAttribute

Introduction

In this page you can find the example usage for org.springframework.web.servlet.handler SimpleMappingExceptionResolver setExceptionAttribute.

Prototype

public void setExceptionAttribute(@Nullable String exceptionAttribute) 

Source Link

Document

Set the name of the model attribute as which the exception should be exposed.

Usage

From source file:org.ameba.http.AbstractMvcConfiguration.java

/**
 * {@inheritDoc}/* w w w. j  a  va2s  .  c  o  m*/
 *
 * Error page is tried to be resolved at public/error, the exception attribute is set to {@literal exception}.
 */
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
    SimpleMappingExceptionResolver smer = new SimpleMappingExceptionResolver();
    smer.setDefaultErrorView("public/error");
    smer.setExceptionAttribute("exception");
    exceptionResolvers.add(smer);
}

From source file:org.meruvian.yama.webapi.config.JaxrsConfig.java

@Bean
@ConditionalOnMissingBean(SimpleMappingExceptionResolver.class)
public SimpleMappingExceptionResolver resteasyExceptionHandler() {
    SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver();
    resolver.setExceptionMappings(new Properties() {
        {/*from w w w  . ja va 2  s . co m*/
            setProperty("org.jboss.resteasy.spi.NoResourceFoundFailure", "resteasyNoResourceFoundView");
        }
    });
    resolver.setExceptionAttribute("exception");

    return resolver;
}