AbstractWebSocketSession.java (spring-framework-5.3.23) | : | AbstractWebSocketSession.java (spring-framework-5.3.24) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2002-2018 the original author or authors. | * Copyright 2002-2022 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. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 63 | skipping to change at line 63 | |||
@Nullable | @Nullable | |||
private T nativeSession; | private T nativeSession; | |||
/** | /** | |||
* Create a new instance and associate the given attributes with it. | * Create a new instance and associate the given attributes with it. | |||
* @param attributes the attributes from the HTTP handshake to associate with the WebSocket | * @param attributes the attributes from the HTTP handshake to associate with the WebSocket | |||
* session; the provided attributes are copied, the original map is not u sed. | * session; the provided attributes are copied, the original map is not u sed. | |||
*/ | */ | |||
public AbstractWebSocketSession(@Nullable Map<String, Object> attributes) { | public AbstractWebSocketSession(@Nullable Map<String, Object> attributes) { | |||
if (attributes != null) { | if (attributes != null) { | |||
this.attributes.putAll(attributes); | attributes.entrySet().stream() | |||
.filter(entry -> (entry.getKey() != null | ||||
&& entry.getValue() != null)) | ||||
.forEach(entry -> this.attributes.put(ent | ||||
ry.getKey(), entry.getValue())); | ||||
} | } | |||
} | } | |||
@Override | @Override | |||
public Map<String, Object> getAttributes() { | public Map<String, Object> getAttributes() { | |||
return this.attributes; | return this.attributes; | |||
} | } | |||
@Override | @Override | |||
public T getNativeSession() { | public T getNativeSession() { | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 6 lines changed or added |