File tree Expand file tree Collapse file tree 4 files changed +13
-10
lines changed
spring-web/src/main/java/org/springframework
spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter
spring-webmvc/src/main/java/org/springframework/web/servlet Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 56
56
*/
57
57
public class ServletServerHttpRequest implements ServerHttpRequest {
58
58
59
- protected static final String FORM_CONTENT_TYPE = "application/x-www-form-urlencoded" ;
60
-
61
59
protected static final Charset FORM_CHARSET = StandardCharsets .UTF_8 ;
62
60
63
61
@@ -230,7 +228,7 @@ public ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse r
230
228
231
229
private static boolean isFormPost (HttpServletRequest request ) {
232
230
String contentType = request .getContentType ();
233
- return (contentType != null && contentType .contains (FORM_CONTENT_TYPE ) &&
231
+ return (contentType != null && contentType .contains (MediaType . APPLICATION_FORM_URLENCODED_VALUE ) &&
234
232
HttpMethod .POST .matches (request .getMethod ()));
235
233
}
236
234
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2021 the original author or authors.
2
+ * Copyright 2002-2022 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
33
33
import jakarta .servlet .http .HttpServletRequestWrapper ;
34
34
35
35
import org .springframework .http .HttpMethod ;
36
+ import org .springframework .http .MediaType ;
36
37
import org .springframework .lang .Nullable ;
37
38
38
39
/**
54
55
*/
55
56
public class ContentCachingRequestWrapper extends HttpServletRequestWrapper {
56
57
57
- private static final String FORM_CONTENT_TYPE = "application/x-www-form-urlencoded" ;
58
-
59
-
60
58
private final ByteArrayOutputStream cachedContent ;
61
59
62
60
@ Nullable
@@ -151,7 +149,7 @@ public String[] getParameterValues(String name) {
151
149
152
150
private boolean isFormPost () {
153
151
String contentType = getContentType ();
154
- return (contentType != null && contentType .contains (FORM_CONTENT_TYPE ) &&
152
+ return (contentType != null && contentType .contains (MediaType . APPLICATION_FORM_URLENCODED_VALUE ) &&
155
153
HttpMethod .POST .matches (getMethod ()));
156
154
}
157
155
Original file line number Diff line number Diff line change @@ -221,7 +221,13 @@ public void onError(Throwable ex) {
221
221
// Ignore result: can't overflow, ok if not first or no one listens
222
222
this .handlerCompletionSink .tryEmitError (ex );
223
223
}
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 );
225
231
}
226
232
227
233
@ Override
Original file line number Diff line number Diff line change 49
49
import org .springframework .core .io .support .PropertiesLoaderUtils ;
50
50
import org .springframework .core .log .LogFormatUtils ;
51
51
import org .springframework .http .HttpMethod ;
52
+ import org .springframework .http .MediaType ;
52
53
import org .springframework .http .server .RequestPath ;
53
54
import org .springframework .http .server .ServletServerHttpRequest ;
54
55
import org .springframework .lang .Nullable ;
@@ -986,7 +987,7 @@ else if (isEnableLoggingRequestDetails()) {
986
987
}
987
988
else {
988
989
// 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 ) ||
990
991
!request .getParameterMap ().isEmpty () ? "masked" : "" );
991
992
}
992
993
You can’t perform that action at this time.
0 commit comments