Comments (2)
With Spring Boot 3.2 and Jetty 12, you can suppress the body of an error that occurs in a situation where it cannot be handled by Spring Boot with the following customizer and error handler:
@Bean
JettyServerCustomizer customizer() {
return (server) -> {
ErrorHandler errorHandler = new NoBodyErrorHandler();
server.setErrorHandler(errorHandler);
server.getHandlers().forEach((handler) -> {
if (handler instanceof WebAppContext webAppContext) {
webAppContext.addConfiguration(new AbstractConfiguration(new AbstractConfiguration.Builder()) {
@Override
public void configure(WebAppContext context) throws Exception {
context.setErrorHandler(errorHandler);
}
});
}
});
};
}
static class NoBodyErrorHandler extends ErrorHandler {
@Override
protected void writeErrorHtml(Request request, Writer writer, Charset charset, int code, String message,
Throwable cause, boolean showStacks) throws IOException {
}
}
With this in place, all three tests in your sample should now pass.
from spring-boot.
Works! Thanks @wilkinsona 🙏
from spring-boot.
Related Issues (20)
- improve jwt error message HOT 1
- Demo application exits immediately on Ubuntu 22 (WSL) HOT 1
- Jartools extract command doesn't extract all files from META-INF
- Spring cloud flavour WebClient is throwing exception when a GetMapping is done. HOT 3
- Server Compression size limit not honored for server.compression.min-response-size configuration HOT 5
- Add configuration key spring.rabbitmq.template.json-trusted-packages HOT 3
- compile error: com.oracle.svm.driver.NativeImage$NativeImageError: Unknown name in option specification: macro:truffle-svm HOT 1
- IllegalStateException: At least one top-level operation source must be registered HOT 1
- Support "docker exec [command]" as readiness checks for containers in Docker Compose HOT 5
- Using relative paths to describe the classpath in the error message from ResolveMainClassName hinders problem diagnosis
- Using relative paths to describe the classpath in the error message from ResolveMainClassName hinders problem diagnosis
- Using relative paths to describe the classpath in the error message from ResolveMainClassName hinders problem diagnosis
- spring.data.redis.cluster.nodes and spring.data.redis.sentinel.nodes do not handle IPv6 addresses correctly
- spring.data.redis.cluster.nodes and spring.data.redis.sentinel.nodes do not handle IPv6 addresses correctly
- Links to Spring Batch javadoc for EnableBatchProcessing and DefaultBatchConfiguration are broken
- After upgrading Spring Boot from 3.1.5 to 3.2.0 properties from application.yml are not read HOT 4
- Clarify that all named properties must match for @ConditionalOnProperty to match
- Clarify that all named properties must match for @ConditionalOnProperty to match
- Spring boot 3.2.5 crash if call wrong method HOT 5
- server.error.include-binding-errors does not recognize MethodValidationResult exceptions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-boot.