Polishing
This commit is contained in:
@@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1551,7 +1551,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
||||
|
||||
|
||||
/**
|
||||
* Return a {@code HttpHeaders} object that can only be read, not written to.
|
||||
* Return an {@code HttpHeaders} object that can only be read, not written to.
|
||||
*/
|
||||
public static HttpHeaders readOnlyHttpHeaders(HttpHeaders headers) {
|
||||
Assert.notNull(headers, "HttpHeaders must not be null");
|
||||
|
||||
@@ -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");
|
||||
* 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
|
||||
*/
|
||||
public void setCodecConfigurer(ServerCodecConfigurer codecConfigurer) {
|
||||
Assert.notNull(codecConfigurer, "ServerCodecConfigurer must not be null");
|
||||
Assert.notNull(codecConfigurer, "ServerCodecConfigurer is required");
|
||||
this.codecConfigurer = codecConfigurer;
|
||||
}
|
||||
|
||||
@@ -159,8 +159,7 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
|
||||
/**
|
||||
* Configure the {@code ApplicationContext} associated with the web application,
|
||||
* if it was initialized with one via
|
||||
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext
|
||||
* WebHttpHandlerBuilder#applicationContext}.
|
||||
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext(ApplicationContext)}.
|
||||
* @param applicationContext the context
|
||||
* @since 5.0.3
|
||||
*/
|
||||
@@ -204,8 +203,7 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
|
||||
return Mono.empty();
|
||||
}
|
||||
if (response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR)) {
|
||||
logger.error("Failed to handle request [" + request.getMethod() + " "
|
||||
+ request.getURI() + "]", ex);
|
||||
logger.error("Failed to handle request [" + request.getMethod() + " " + request.getURI() + "]", ex);
|
||||
return Mono.empty();
|
||||
}
|
||||
// After the response is committed, propagate errors to the server..
|
||||
@@ -214,11 +212,12 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
|
||||
return Mono.error(ex);
|
||||
}
|
||||
|
||||
private boolean isDisconnectedClientError(Throwable ex) {
|
||||
private boolean isDisconnectedClientError(Throwable ex) {
|
||||
String message = NestedExceptionUtils.getMostSpecificCause(ex).getMessage();
|
||||
message = (message != null ? message.toLowerCase() : "");
|
||||
String className = ex.getClass().getSimpleName();
|
||||
return (message.contains("broken pipe") || DISCONNECTED_CLIENT_EXCEPTIONS.contains(className));
|
||||
if (message != null && message.toLowerCase().contains("broken pipe")) {
|
||||
return true;
|
||||
}
|
||||
return DISCONNECTED_CLIENT_EXCEPTIONS.contains(ex.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user