spring StandardToWebSocketExtensionAdapter 源码
spring StandardToWebSocketExtensionAdapter 代码
文件路径:/spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/StandardToWebSocketExtensionAdapter.java
/*
* Copyright 2002-2022 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.socket.adapter.standard;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import jakarta.websocket.Extension;
import org.springframework.util.LinkedCaseInsensitiveMap;
import org.springframework.web.socket.WebSocketExtension;
/**
* A subclass of {@link WebSocketExtension} that can be constructed from a
* {@link jakarta.websocket.Extension}.
*
* @author Rossen Stoyanchev
* @since 4.0
*/
public class StandardToWebSocketExtensionAdapter extends WebSocketExtension {
public StandardToWebSocketExtensionAdapter(Extension extension) {
super(extension.getName(), initParameters(extension));
}
private static Map<String, String> initParameters(Extension extension) {
List<Extension.Parameter> parameters = extension.getParameters();
Map<String, String> result = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ENGLISH);
for (Extension.Parameter parameter : parameters) {
result.put(parameter.getName(), parameter.getValue());
}
return result;
}
}
相关信息
相关文章
spring ConvertingEncoderDecoderSupport 源码
spring StandardWebSocketHandlerAdapter 源码
spring StandardWebSocketSession 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦