Filter out null
WebSocket session attributes
#29315
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Affects: <Spring Framework version 5.3.22, 5.3.23, maybe earlier>
my codes
step 0(optional): prepare the spring boot project, add dependency:
org.springframework.boot:spring-boot-starter-websocket
step 1: custom HandshakeInterceptor
step2: WebSocketConfigurer
step3: client html
error log
tracking & analysis
found code call path:
AbstractStandardUpgradeStrategy#upgrade
->StandardWebSocketSession session = new StandardWebSocketSession(headers, attrs, localAddr, remoteAddr, user);
->
StandardWebSocketSession#constructor
->first linesuper(attributes);
The code where the exception finally occurs:
It is recommended to add a null value judgment and throw an exception or filter none-null key-value here。
The text was updated successfully, but these errors were encountered: