Skip to content

Commit 1aa4e7c

Browse files
committed
Merge branch '5.3.x'
2 parents 56a8c1a + 2172b99 commit 1aa4e7c

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@
5656
*/
5757
public class ServletServerHttpRequest implements ServerHttpRequest {
5858

59-
protected static final String FORM_CONTENT_TYPE = "application/x-www-form-urlencoded";
60-
6159
protected static final Charset FORM_CHARSET = StandardCharsets.UTF_8;
6260

6361

@@ -230,7 +228,7 @@ public ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse r
230228

231229
private static boolean isFormPost(HttpServletRequest request) {
232230
String contentType = request.getContentType();
233-
return (contentType != null && contentType.contains(FORM_CONTENT_TYPE) &&
231+
return (contentType != null && contentType.contains(MediaType.APPLICATION_FORM_URLENCODED_VALUE) &&
234232
HttpMethod.POST.matches(request.getMethod()));
235233
}
236234

spring-web/src/main/java/org/springframework/web/util/ContentCachingRequestWrapper.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@
3333
import jakarta.servlet.http.HttpServletRequestWrapper;
3434

3535
import org.springframework.http.HttpMethod;
36+
import org.springframework.http.MediaType;
3637
import org.springframework.lang.Nullable;
3738

3839
/**
@@ -54,9 +55,6 @@
5455
*/
5556
public class ContentCachingRequestWrapper extends HttpServletRequestWrapper {
5657

57-
private static final String FORM_CONTENT_TYPE = "application/x-www-form-urlencoded";
58-
59-
6058
private final ByteArrayOutputStream cachedContent;
6159

6260
@Nullable
@@ -151,7 +149,7 @@ public String[] getParameterValues(String name) {
151149

152150
private boolean isFormPost() {
153151
String contentType = getContentType();
154-
return (contentType != null && contentType.contains(FORM_CONTENT_TYPE) &&
152+
return (contentType != null && contentType.contains(MediaType.APPLICATION_FORM_URLENCODED_VALUE) &&
155153
HttpMethod.POST.matches(getMethod()));
156154
}
157155

spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@ public void onError(Throwable ex) {
221221
// Ignore result: can't overflow, ok if not first or no one listens
222222
this.handlerCompletionSink.tryEmitError(ex);
223223
}
224-
close(CloseStatus.SERVER_ERROR.withReason(ex.getMessage()));
224+
if (logger.isDebugEnabled()) {
225+
logger.debug("WebSocket session completed with error", ex);
226+
}
227+
else if (logger.isInfoEnabled()) {
228+
logger.info("WebSocket session completed with error: " + ex.getMessage());
229+
}
230+
close(CloseStatus.SERVER_ERROR);
225231
}
226232

227233
@Override

spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.springframework.core.io.support.PropertiesLoaderUtils;
5050
import org.springframework.core.log.LogFormatUtils;
5151
import org.springframework.http.HttpMethod;
52+
import org.springframework.http.MediaType;
5253
import org.springframework.http.server.RequestPath;
5354
import org.springframework.http.server.ServletServerHttpRequest;
5455
import org.springframework.lang.Nullable;
@@ -986,7 +987,7 @@ else if (isEnableLoggingRequestDetails()) {
986987
}
987988
else {
988989
// Avoid request body parsing for form data
989-
params = (StringUtils.startsWithIgnoreCase(contentType, "application/x-www-form-urlencoded") ||
990+
params = (StringUtils.startsWithIgnoreCase(contentType, MediaType.APPLICATION_FORM_URLENCODED_VALUE) ||
990991
!request.getParameterMap().isEmpty() ? "masked" : "");
991992
}
992993

0 commit comments

Comments
 (0)