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

The following examples show how to use org.springframework.boot.autoconfigure.web.ErrorProperties. These examples are extracted from open source projects. 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 Project: beihu-boot   Source File: DefaultErrorController.java    License: 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 2
Source Project: springboot-learn   Source File: ErrorPagesController.java    License: 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 Project: syhthems-platform   Source File: CustomErrorController.java    License: 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 4
Source Project: springboot-shiro   Source File: ErrorPagesController.java    License: 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 5
Source Project: halo   Source File: CommonController.java    License: 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 6
@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
@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
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 9
Source Project: WeBASE-Node-Manager   Source File: ErrorController.java    License: Apache License 2.0 4 votes vote down vote up
public ErrorController() {
    super(new DefaultErrorAttributes(), new ErrorProperties());
}
 
Example 10
public GlobalExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                              ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example 11
Source Project: uexam   Source File: ErrorController.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
public ErrorController() {
    super(new DefaultErrorAttributes(), new ErrorProperties());
}
 
Example 12
Source Project: beihu-boot   Source File: DefaultErrorController.java    License: Apache License 2.0 4 votes vote down vote up
public DefaultErrorController() {
    super(new DefaultErrorAttributes());
    errorProperties = new ErrorProperties();
    errorProperties.setPath("/error");
}
 
Example 13
public JsonExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
		ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example 14
Source Project: FEBS-Cloud   Source File: FebsGatewayExceptionHandler.java    License: 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 15
public JsonErrorWebExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                                    ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example 16
Source Project: SpringBlade   Source File: ErrorExceptionHandler.java    License: Apache License 2.0 4 votes vote down vote up
public ErrorExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
							 ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example 17
public ErrorController() {
    super(new DefaultErrorAttributes(), new ErrorProperties());
}
 
Example 18
Source Project: fw-spring-cloud   Source File: FwGatewayExceptionHandler.java    License: Apache License 2.0 4 votes vote down vote up
public FwGatewayExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                                 ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example 19
public JsonExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                            ErrorProperties errorProperties, ApplicationContext applicationContext) {
    super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example 20
Source Project: sophia_scaffolding   Source File: JsonExceptionHandler.java    License: 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 21
Source Project: sophia_scaffolding   Source File: JsonExceptionHandler.java    License: 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 22
Source Project: sophia_scaffolding   Source File: JsonExceptionHandler.java    License: 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 23
Source Project: syhthems-platform   Source File: CustomErrorController.java    License: MIT License 4 votes vote down vote up
private ErrorProperties getErrorProperties() {
    return this.errorProperties;
}
 
Example 24
public GlobalExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
                              ErrorProperties errorProperties, ApplicationContext applicationContext) {
	super(errorAttributes, resourceProperties, errorProperties, applicationContext);
}
 
Example 25
public CustomServletErrorController(ErrorAttributes errorAttributes,
                                    ErrorProperties errorProperties,
                                    List<ErrorViewResolver> resolvers) {
    super(errorAttributes, errorProperties, resolvers);
}
 
Example 26
Source Project: NoteBlog   Source File: ErrorController.java    License: MIT License 4 votes vote down vote up
private boolean isIncludeStackTrace(HttpServletRequest request) {
    ErrorProperties.IncludeStacktrace include = this.serverProperties.getError().getIncludeStacktrace();
    return include == ErrorProperties.IncludeStacktrace.ALWAYS || include == ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM && getTraceParameter(request);
}
 
Example 27
public BladeErrorController(ErrorAttributes errorAttributes, ErrorProperties errorProperties) {
	super(errorAttributes, errorProperties);
}
 
Example 28
Source Project: crnk-framework   Source File: CrnkErrorController.java    License: Apache License 2.0 4 votes vote down vote up
public CrnkErrorController(ErrorAttributes errorAttributes,
						   ErrorProperties errorProperties) {
	super(errorAttributes, errorProperties);
}
 
Example 29
Source Project: crnk-framework   Source File: CrnkErrorController.java    License: Apache License 2.0 4 votes vote down vote up
public CrnkErrorController(ErrorAttributes errorAttributes,
						   ErrorProperties errorProperties,
						   List<ErrorViewResolver> errorViewResolvers) {
	super(errorAttributes, errorProperties, errorViewResolvers);
}
 
Example 30
Source Project: crnk-framework   Source File: CrnkErrorController.java    License: Apache License 2.0 4 votes vote down vote up
public CrnkErrorController(ErrorAttributes errorAttributes,
						   ErrorProperties errorProperties) {
	super(errorAttributes, errorProperties);
}