|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -126,7 +126,7 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa |
|
|
|
* @param codecConfigurer the codec configurer to use |
|
|
|
* @param codecConfigurer the codec configurer to use |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setCodecConfigurer(ServerCodecConfigurer codecConfigurer) { |
|
|
|
public void setCodecConfigurer(ServerCodecConfigurer codecConfigurer) { |
|
|
|
Assert.notNull(codecConfigurer, "ServerCodecConfigurer must not be null"); |
|
|
|
Assert.notNull(codecConfigurer, "ServerCodecConfigurer is required"); |
|
|
|
this.codecConfigurer = codecConfigurer; |
|
|
|
this.codecConfigurer = codecConfigurer; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -159,8 +159,7 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Configure the {@code ApplicationContext} associated with the web application, |
|
|
|
* Configure the {@code ApplicationContext} associated with the web application, |
|
|
|
* if it was initialized with one via |
|
|
|
* if it was initialized with one via |
|
|
|
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext |
|
|
|
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext(ApplicationContext)}. |
|
|
|
* WebHttpHandlerBuilder#applicationContext}. |
|
|
|
|
|
|
|
* @param applicationContext the context |
|
|
|
* @param applicationContext the context |
|
|
|
* @since 5.0.3 |
|
|
|
* @since 5.0.3 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ -204,8 +203,7 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa |
|
|
|
return Mono.empty(); |
|
|
|
return Mono.empty(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR)) { |
|
|
|
if (response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR)) { |
|
|
|
logger.error("Failed to handle request [" + request.getMethod() + " " |
|
|
|
logger.error("Failed to handle request [" + request.getMethod() + " " + request.getURI() + "]", ex); |
|
|
|
+ request.getURI() + "]", ex); |
|
|
|
|
|
|
|
return Mono.empty(); |
|
|
|
return Mono.empty(); |
|
|
|
} |
|
|
|
} |
|
|
|
// After the response is committed, propagate errors to the server..
|
|
|
|
// After the response is committed, propagate errors to the server..
|
|
|
|
@ -216,9 +214,10 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa |
|
|
|
|
|
|
|
|
|
|
|
private boolean isDisconnectedClientError(Throwable ex) { |
|
|
|
private boolean isDisconnectedClientError(Throwable ex) { |
|
|
|
String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage(); |
|
|
|
String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage(); |
|
|
|
message = (message != null ? message.toLowerCase() : ""); |
|
|
|
if (message != null && message.toLowerCase().contains("broken pipe")) { |
|
|
|
String className = ex.getClass().getSimpleName(); |
|
|
|
return true; |
|
|
|
return (message.contains("broken pipe") || DISCONNECTED_CLIENT_EXCEPTIONS.contains(className)); |
|
|
|
} |
|
|
|
|
|
|
|
return DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|