org.springframework.boot.autoconfigure.web.ErrorProperties Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.web.ErrorProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CommonController.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Determine if the stacktrace attribute should be included.
 *
 * @param request the source request
 * @return if the stacktrace attribute should be included
 */
private boolean isIncludeStackTrace(HttpServletRequest request) {
    ErrorProperties.IncludeStacktrace include = errorProperties.getIncludeStacktrace();
    if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
        return true;
    }
    if (include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM) {
        return getTraceParameter(request);
    }
    return false;
}
 
Example #2
Source File: ErrorPagesController.java    From springboot-shiro with MIT License 5 votes vote down vote up
/**
 * Determine if the stacktrace attribute should be included.
 *
 * @param request  the source request
 * @param produces the media type produced (or {@code MediaType.ALL})
 * @return if the stacktrace attribute should be included
 */
protected boolean isIncludeStackTrace(HttpServletRequest request,
                                      MediaType produces) {
    ErrorProperties.IncludeStacktrace include = this.serverProperties.getError().getIncludeStacktrace();
    if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
        return true;
    }
    return include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM && getTraceParameter(request);
}
 
Example #3
Source File: DefaultErrorController.java    From beihu-boot with Apache License 2.0 5 votes vote down vote up
public DefaultErrorController(ErrorAttributes errorAttributes, ServerProperties properties) {
    super(errorAttributes == null ? new DefaultErrorAttributes() : errorAttributes);
    if (properties == null) {
        errorProperties = new ErrorProperties();
        errorProperties.setPath("/error");
    } else {
        this.errorProperties = properties.getError();
    }
}
 
Example #4
Source File: CustomErrorController.java    From syhthems-platform with MIT License 5 votes vote down vote up
private boolean isIncludeStackTrace(HttpServletRequest request,
                                    MediaType produces) {
    ErrorProperties.IncludeStacktrace include = getErrorProperties().getIncludeStacktrace();
    if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
        return true;
    }
    if (include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM) {
        return getTraceParameter(request);
    }
    return false;
}
 
Example #5
Source File: FunctionEndpointInitializer.java    From spring-cloud-function with Apache License 2.0 5 votes vote down vote up
private DefaultErrorWebExceptionHandler errorHandler(GenericApplicationContext context) {
	context.registerBean(ErrorAttributes.class, () -> new DefaultErrorAttributes());
	context.registerBean(ErrorProperties.class, () -> new ErrorProperties());
	context.registerBean(ResourceProperties.class, () -> new ResourceProperties());
	DefaultErrorWebExceptionHandler handler = new DefaultErrorWebExceptionHandler(
			context.getBean(ErrorAttributes.class), context.getBean(ResourceProperties.class),
			context.getBean(ErrorProperties.class), context);
	ServerCodecConfigurer codecs = ServerCodecConfigurer.create();
	handler.setMessageWriters(codecs.getWriters());
	handler.setMessageReaders(codecs.getReaders());
	return handler;
}
 
Example #6
Source File: BackstopperSpringboot1ContainerErrorControllerTest.java    From backstopper with Apache License 2.0 5 votes vote down vote up
@Before
public void beforeMethod() {
    projectApiErrorsMock = mock(ProjectApiErrors.class);
    unhandledContainerErrorHelperMock = mock(UnhandledServletContainerErrorHelper.class);
    servletRequestMock = mock(ServletRequest.class);
    serverPropertiesMock = mock(ServerProperties.class);
    errorPropertiesMock = mock(ErrorProperties.class);
    errorPath = UUID.randomUUID().toString();

    doReturn(errorPropertiesMock).when(serverPropertiesMock).getError();
    doReturn(errorPath).when(errorPropertiesMock).getPath();
}
 
Example #7
Source File: BackstopperSpringboot2ContainerErrorControllerTest.java    From backstopper with Apache License 2.0 5 votes vote down vote up
@Before
public void beforeMethod() {
    projectApiErrorsMock = mock(ProjectApiErrors.class);
    unhandledContainerErrorHelperMock = mock(UnhandledServletContainerErrorHelper.class);
    servletRequestMock = mock(ServletRequest.class);
    serverPropertiesMock = mock(ServerProperties.class);
    errorPropertiesMock = mock(ErrorProperties.class);
    errorPath = UUID.randomUUID().toString();

    doReturn(errorPropertiesMock).when(serverPropertiesMock).getError();
    doReturn(errorPath).when(errorPropertiesMock).getPath();
}
 
Example #8
Source File: ErrorPagesController.java    From springboot-learn with MIT License 5 votes vote down vote up
/**
 * Determine if the stacktrace attribute should be included.
 *
 * @param request  the source request
 * @param produces the media type produced (or {@code MediaType.ALL})
 * @return if the stacktrace attribute should be included
 */
protected boolean isIncludeStackTrace(HttpServletRequest request,
                                      MediaType produces) {
    ErrorProperties.IncludeStacktrace include = this.serverProperties.getError().getIncludeStacktrace();
    if (include == ErrorProperties.IncludeStacktrace.ALWAYS) {
        return true;
    }
    return include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM && getTraceParameter(request);
}
 
Example #9
Source File: MetacatErrorController.java    From metacat with Apache License 2.0 4 votes vote down vote up
/**
 * Determine if the stacktrace attribute should be included.
 * @param request the source request
 * @return if the stacktrace attribute should be included
 */
private boolean isIncludeStackTrace(final HttpServletRequest request) {
    final ErrorProperties.IncludeStacktrace include = this.errorProperties.getIncludeStacktrace();
    return include == ErrorProperties.IncludeStacktrace.ALWAYS
        || include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM && getTraceParameter(request);
}
 
Example #10
Source File: BladeErrorController.java    From blade-tool with GNU Lesser General Public License v3.0 4 votes vote down vote up
public BladeErrorController(ErrorAttributes errorAttributes, ErrorProperties errorProperties) {
	super(errorAttributes, errorProperties);
}
 
Example #11
Source File: CrnkErrorController.java    From crnk-framework with Apache License 2.0 4 votes vote down vote up
public CrnkErrorController(ErrorAttributes errorAttributes,
						   ErrorProperties errorProperties) {
	super(errorAttributes, errorProperties);
}
 
Example #12
Source File: CrnkErrorController.java    From crnk-framework with Apache License 2.0 4 votes vote down vote up
public CrnkErrorController(ErrorAttributes errorAttributes,
						   ErrorProperties errorProperties,
						   List<ErrorViewResolver> errorViewResolvers) {
	super(errorAttributes, errorProperties, errorViewResolvers);
}
 
Example #13
Source File: CrnkErrorController.java    From crnk-framework with Apache License 2.0 4 votes vote down vote up
public CrnkErrorController(ErrorAttributes errorAttributes,
						   ErrorProperties errorProperties) {
	super(errorAttributes, errorProperties);
}
 
Example #14
Source File: CustomErrorController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
public CustomErrorController(ErrorAttributes errorAttributes,
    ErrorProperties errorProperties) {
  super(errorAttributes, errorProperties);
}
 
Example #15
Source File: CustomErrorController.java    From spring-mvc-error-handling-example with Apache License 2.0 4 votes vote down vote up
public CustomErrorController(ErrorAttributes errorAttributes,
    ErrorProperties errorProperties,
    List<ErrorViewResolver> errorViewResolvers) {
  super(errorAttributes, errorProperties, errorViewResolvers);
}
 
Example #16
Source File: ApiConfig.java    From metacat with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the default error properties.
 * @return default error properties.
 */
@Bean
public ErrorProperties errorProperties() {
    return new ErrorProperties();
}
 
Example #17
Source File: MyErrorController.java    From tutorials with MIT License 4 votes vote down vote up
public MyErrorController(ErrorAttributes errorAttributes) {
    super(errorAttributes, new ErrorProperties());
}
 
Example #18
Source File: DataResultErrorController.java    From onetwo with Apache License 2.0 4 votes vote down vote up
public DataResultErrorController(ErrorAttributes errorAttributes, ErrorProperties errorProperties) {
	super(errorAttributes, errorProperties);
}
 
Example #19
Source File: DataResultErrorController.java    From onetwo with Apache License 2.0 4 votes vote down vote up
public DataResultErrorController(ErrorAttributes errorAttributes,
		ErrorProperties errorProperties,
		List<ErrorViewResolver> errorViewResolvers) {
	super(errorAttributes, errorProperties, errorViewResolvers);
}
 
Example #20
Source File: CommonErrorController.java    From EasyReport with Apache License 2.0 4 votes vote down vote up
public CommonErrorController(final ErrorAttributes errorAttributes,
                             ErrorProperties errorProperties) {
    super(errorAttributes);
    this.errorProperties = errorProperties;
}
 
Example #21
Source File: CustomErrorController.java    From EasyReport with Apache License 2.0 4 votes vote down vote up
public CustomErrorController(final ErrorAttributes errorAttributes,
                             final ErrorProperties errorProperties) {
    super(errorAttributes, errorProperties);
}
 
Example #22
Source File: ServletConfig.java    From EasyReport with Apache License 2.0 4 votes vote down vote up
@Bean
public ErrorProperties errorProperties() {
    final ErrorProperties properties = new ErrorProperties();
    properties.setIncludeStacktrace(IncludeStacktrace.ALWAYS);
    return properties;
}
 
Example #23
Source File: ErrorController.java    From WeBASE-Node-Manager with Apache License 2.0 4 votes vote down vote up
public ErrorController() {
    super(new DefaultErrorAttributes(), new ErrorProperties());
}
 
Example #24
Source File: JsonExceptionHandler.java    From momo-cloud-permission with Apache License 2.0 4 votes vote down vote up
public JsonExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                            ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #25
Source File: GlobalExceptionHandler.java    From codeway_service with GNU General Public License v3.0 4 votes vote down vote up
public GlobalExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                              ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #26
Source File: ErrorController.java    From uexam with GNU Affero General Public License v3.0 4 votes vote down vote up
public ErrorController() {
    super(new DefaultErrorAttributes(), new ErrorProperties());
}
 
Example #27
Source File: DefaultErrorController.java    From beihu-boot with Apache License 2.0 4 votes vote down vote up
public DefaultErrorController() {
    super(new DefaultErrorAttributes());
    errorProperties = new ErrorProperties();
    errorProperties.setPath("/error");
}
 
Example #28
Source File: JsonExceptionHandler.java    From open-capacity-platform with Apache License 2.0 4 votes vote down vote up
public JsonExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
		ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #29
Source File: FebsGatewayExceptionHandler.java    From FEBS-Cloud with Apache License 2.0 4 votes vote down vote up
public FebsGatewayExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                                   ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example #30
Source File: JsonErrorWebExceptionHandler.java    From microservices-platform with Apache License 2.0 4 votes vote down vote up
public JsonErrorWebExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                                    ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}