Java 类org.springframework.boot.autoconfigure.web.ErrorAttributes 实例源码

项目:spring-boot-jpa    文件:BootJpaApplication.java   
/**
 * Customized ErrorAttribute bean.
 * We really need to find a cleaner way of handling these error messages.
 *
 * @return customized ErrorAttributes
 */
@Bean
public ErrorAttributes errorAttributes() {
    return new DefaultErrorAttributes() {

        @Override
        public Map<String, Object> getErrorAttributes(
                final RequestAttributes requestAttributes,
                final boolean includeStackTrace) {
            Map<String, Object> attributes = super
                    .getErrorAttributes(requestAttributes, includeStackTrace);
            Throwable error = getError(requestAttributes);

            if (error instanceof MethodArgumentNotValidException) {
                MethodArgumentNotValidException ex =
                        ((MethodArgumentNotValidException) error);
                attributes.put("errors", ex.getMessage());
            }

            return attributes;
        }
    };
}
项目:spring-mvc-error-handling-example    文件:CustomErrorControllerConfiguration.java   
/**
 * 抄的是{@link ErrorMvcAutoConfiguration#basicErrorController(ErrorAttributes)}
 *
 * @param errorAttributes
 * @return
 */
@Bean
public CustomErrorController customErrorController(ErrorAttributes errorAttributes) {
  return new CustomErrorController(
      errorAttributes,
      this.serverProperties.getError(),
      this.errorViewResolvers
  );
}
项目:errorest-spring-boot-starter    文件:BindExceptionErrorDataProvider.java   
@Override
public ErrorData getErrorData(BindException ex, HttpServletRequest request, HttpStatus defaultResponseStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    String requestUri = getRequestUri(errorAttributes, requestAttributes);
    return buildErrorData(ex.getBindingResult())
            .withRequestMethod(request.getMethod())
            .withRequestUri(requestUri)
            .withThrowable(ex)
            .build();
}
项目:errorest-spring-boot-starter    文件:MethodArgumentNotValidErrorDataProvider.java   
@Override
public ErrorData getErrorData(MethodArgumentNotValidException ex, HttpServletRequest request, HttpStatus defaultResponseStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    String requestUri = getRequestUri(errorAttributes, requestAttributes);
    return buildErrorData(ex.getBindingResult())
            .withRequestMethod(request.getMethod())
            .withRequestUri(requestUri)
            .withThrowable(ex)
            .build();
}
项目:errorest-spring-boot-starter    文件:SecurityErrorDataProvider.java   
@Override
public ErrorData getErrorData(T ex, HttpServletRequest request, HttpStatus defaultResponseStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    String requestUri = getRequestUri(errorAttributes, requestAttributes);
    String requestHeaders = getRequestHeaders(requestAttributes);
    return buildErrorData(ex, requestHeaders)
            .withRequestMethod(request.getMethod())
            .withRequestUri(requestUri)
            .build();
}
项目:errorest-spring-boot-starter    文件:ThrowableErrorDataProvider.java   
@Override
public ErrorData getErrorData(Throwable ex, HttpServletRequest request, HttpStatus defaultResponseStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    String requestUri = getRequestUri(errorAttributes, requestAttributes);
    return buildErrorData(ex, defaultResponseStatus)
            .withRequestMethod(request.getMethod())
            .withRequestUri(requestUri)
            .withResponseStatus(defaultResponseStatus)
            .build();
}
项目:errorest-spring-boot-starter    文件:HttpClientErrorDataProvider.java   
@Override
public ErrorData getErrorData(T ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    String requestUri = getRequestUri(errorAttributes, requestAttributes);
    return buildErrorData(ex, responseHttpStatus)
            .withRequestMethod(request.getMethod())
            .withRequestUri(requestUri)
            .build();
}
项目:errorest-spring-boot-starter    文件:ExternalHttpRequestErrorDataProvider.java   
@Override
public ErrorData getErrorData(ExternalHttpRequestException ex, HttpServletRequest request, HttpStatus defaultResponseStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    String requestUri = getRequestUri(errorAttributes, requestAttributes);
    return buildErrorData(ex, ex.getStatusCode())
            .withRequestMethod(request.getMethod())
            .withRequestUri(requestUri)
            .build();
}
项目:errorest-spring-boot-starter    文件:ApplicationErrorDataProvider.java   
@Override
public ErrorData getErrorData(ApplicationException ex, HttpServletRequest request, HttpStatus defaultResponseStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    String requestUri = getRequestUri(errorAttributes, requestAttributes);
    return buildErrorData(ex)
            .withRequestMethod(request.getMethod())
            .withRequestUri(requestUri)
            .build();
}
项目:errorest-spring-boot-starter    文件:ServletFilterErrorHandler.java   
public ServletFilterErrorHandler(ErrorAttributes errorAttributes, ServerProperties serverProperties, ErrorsFactory errorsFactory, ErrorDataProviderContext providerContext) {
    super(errorAttributes, emptyList());
    this.errorAttributes = errorAttributes;
    errorProperties = serverProperties.getError();
    this.errorsFactory = errorsFactory;
    this.providerContext = providerContext;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:TraceWebFilterAutoConfiguration.java   
public TraceWebFilterAutoConfiguration(TraceRepository traceRepository,
        TraceProperties traceProperties,
        ObjectProvider<ErrorAttributes> errorAttributesProvider) {
    this.traceRepository = traceRepository;
    this.traceProperties = traceProperties;
    this.errorAttributes = errorAttributesProvider.getIfAvailable();
}
项目:searchbox-core    文件:SearchBoxConfiguration.java   
@Bean
public ErrorAttributes customizeErrorResponseAttributes() {

    return new DefaultErrorAttributes(){
        @Override
        public Map<String, Object> getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) {
            Map<String, Object> errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace);
            errorAttributes.remove("timestamp");
            errorAttributes.remove("exception");
            return errorAttributes;
        }
    };

}
项目:spring-boot-concourse    文件:TraceWebFilterAutoConfiguration.java   
public TraceWebFilterAutoConfiguration(TraceRepository traceRepository,
        TraceProperties traceProperties,
        ObjectProvider<ErrorAttributes> errorAttributesProvider) {
    this.traceRepository = traceRepository;
    this.traceProperties = traceProperties;
    this.errorAttributes = errorAttributesProvider.getIfAvailable();
}
项目:contestparser    文件:EndpointWebMvcChildContextConfiguration.java   
@Bean
@ConditionalOnBean(ErrorAttributes.class)
public ManagementErrorEndpoint errorEndpoint(ServerProperties serverProperties,
        ErrorAttributes errorAttributes) {
    return new ManagementErrorEndpoint(serverProperties.getError().getPath(),
            errorAttributes);
}
项目:OpenConext-pdp    文件:ErrorControllerTest.java   
@Before
public void before() {
    this.errorAttributes = mock(ErrorAttributes.class);

    Map<String, Object> result = new HashMap<>();
    result.put("exception", "exception");
    result.put("message", "message");

    when(errorAttributes.getErrorAttributes(any(), anyBoolean())).thenReturn(result);

    this.subject = new ErrorController(errorAttributes);
}
项目:spring-cloud-skipper    文件:SkipperServerConfiguration.java   
@Bean
public ErrorAttributes errorAttributes() {
    // override boot's DefaultErrorAttributes
    return new SkipperErrorAttributes();
}
项目:emergentmud    文件:ErrorResource.java   
@Inject
public ErrorResource(ErrorAttributes errorAttributes) {
    super(errorAttributes);

    this.errorAttributes = errorAttributes;
}
项目:myfavor    文件:CustomErrorController.java   
public CustomErrorController(ErrorAttributes errorAttributes) {
    super(errorAttributes);
}
项目:crnk-framework    文件:CrnkErrorController.java   
public CrnkErrorController(ErrorAttributes errorAttributes,
        ErrorProperties errorProperties) {
    super(errorAttributes, errorProperties);
}
项目:crnk-framework    文件:CrnkErrorController.java   
public CrnkErrorController(ErrorAttributes errorAttributes,
        ErrorProperties errorProperties,
        List<ErrorViewResolver> errorViewResolvers) {
    super(errorAttributes, errorProperties, errorViewResolvers);
}
项目:crnk-framework    文件:CrnkErrorControllerAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(value = ErrorController.class, search = SearchStrategy.CURRENT)
public BasicErrorController jsonapiErrorController(ErrorAttributes errorAttributes) {
    return new CrnkErrorController(errorAttributes, this.serverProperties.getError(), this.errorViewResolvers);
}
项目:counter-cloud    文件:ZuulErrorController.java   
public ZuulErrorController(ErrorAttributes errorAttributes) {
    super(errorAttributes);
}
项目:spring-mvc-error-handling-example    文件:CustomErrorController.java   
public CustomErrorController(ErrorAttributes errorAttributes,
    ErrorProperties errorProperties) {
  super(errorAttributes, errorProperties);
}
项目:spring-mvc-error-handling-example    文件:CustomErrorController.java   
public CustomErrorController(ErrorAttributes errorAttributes,
    ErrorProperties errorProperties,
    List<ErrorViewResolver> errorViewResolvers) {
  super(errorAttributes, errorProperties, errorViewResolvers);
}
项目:spring-mvc-error-handling-example    文件:CustomErrorAttributesConfiguration.java   
@Bean
public ErrorAttributes errorAttributes() {
  return new CustomErrorAttributes();
}
项目:SpringBootStudy    文件:DemoErrorController.java   
/**
 * 初始化ExceptionController
 */
@Autowired
public DemoErrorController(ErrorAttributes errorAttributes) {
    Assert.notNull(errorAttributes, "ErrorAttributes must not be null");
    this.errorAttributes = errorAttributes;
}
项目:errorest-spring-boot-starter    文件:MissingServletRequestParameterErrorDataProvider.java   
@Override
public ErrorData getErrorData(MissingServletRequestParameterException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, BAD_REQUEST, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:ServletRequestBindingErrorDataProvider.java   
@Override
public ErrorData getErrorData(ServletRequestBindingException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, BAD_REQUEST, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:NoHandlerFoundErrorDataProvider.java   
@Override
public ErrorData getErrorData(NoHandlerFoundException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, NOT_FOUND, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:TypeMismatchErrorDataProvider.java   
@Override
public ErrorData getErrorData(TypeMismatchException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, BAD_REQUEST, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:MissingServletRequestPartErrorDataProvider.java   
@Override
public ErrorData getErrorData(MissingServletRequestPartException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, BAD_REQUEST, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:MediaTypeNotAcceptableErrorDataProvider.java   
@Override
public ErrorData getErrorData(HttpMediaTypeNotAcceptableException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, NOT_ACCEPTABLE, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:MessageNotReadableErrorDataProvider.java   
@Override
public ErrorData getErrorData(HttpMessageNotReadableException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, BAD_REQUEST, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:RequestMethodNotSupportedErrorDataProvider.java   
@Override
public ErrorData getErrorData(HttpRequestMethodNotSupportedException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, METHOD_NOT_ALLOWED, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:MediaTypeNotSupportedErrorDataProvider.java   
@Override
public ErrorData getErrorData(HttpMediaTypeNotSupportedException ex, HttpServletRequest request, HttpStatus responseHttpStatus, ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return super.getErrorData(ex, request, UNSUPPORTED_MEDIA_TYPE, errorAttributes, requestAttributes);
}
项目:errorest-spring-boot-starter    文件:ErrorDataProvider.java   
protected String getRequestUri(ErrorAttributes errorAttributes, RequestAttributes requestAttributes) {
    return errorAttributes.getErrorAttributes(requestAttributes, false).getOrDefault(REQUEST_URI_ERROR_ATTRIBUTE, NOT_AVAILABLE_DATA).toString();
}
项目:errorest-spring-boot-starter    文件:ErrorestConfiguration.java   
@Bean
@ConditionalOnMissingBean
public ServletFilterErrorHandler servletFilterErrorHandler(ErrorAttributes errorAttributes, ErrorsFactory errorsFactory, ErrorDataProviderContext providerContext) {
    return new ServletFilterErrorHandler(errorAttributes, serverProperties, errorsFactory, providerContext);
}
项目:infiniboard    文件:QuartermasterErrorController.java   
public QuartermasterErrorController(ErrorAttributes errorAttributes) {
  this.errorAttributes = errorAttributes;
}
项目:diablo    文件:TowerIndexes.java   
@Autowired
public TowerIndexes(ErrorAttributes errorAttributes) {
    super(errorAttributes);
}
项目:alpha-umi    文件:CustomErrorController.java   
/**
 * @param errorAttributes
 */
@Autowired
public CustomErrorController(ErrorAttributes errorAttributes) {
    Assert.notNull(errorAttributes, "ErrorAttributes must not be null");
    this.errorAttributes = errorAttributes;
}