ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/jakarta/websocket/ContainerProvider.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/jakarta/websocket/ContainerProvider.java
Status
scanned
Type
file
Name
ContainerProvider.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
2368 (2.3 KB)
MD5
d8897343693b9c0ccd5cb3bdc08464a2
SHA1
96f8c8aba0d37bee18b7df1198791167c0300a92
SHA256
e03fa3414d71b510e4e1098bffc15072556a0b25d11ba204befa581e6371ac51
SHA512

      
    
SHA1_git
6c90bdc0d7514c33e320b0dc3da76b78dc7c1dba
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
ContainerProvider.java | 2.3 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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 * * http://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 jakarta.websocket; import java.util.Iterator; import java.util.ServiceLoader; /** * Use the {@link ServiceLoader} mechanism to provide instances of the WebSocket client container. */ public abstract class ContainerProvider { private static final String DEFAULT_PROVIDER_CLASS_NAME = "org.apache.tomcat.websocket.WsWebSocketContainer"; /** * Create a new container used to create outgoing WebSocket connections. * * @return A newly created container. */ public static WebSocketContainer getWebSocketContainer() { WebSocketContainer result = null; ServiceLoader<ContainerProvider> serviceLoader = ServiceLoader.load(ContainerProvider.class); Iterator<ContainerProvider> iter = serviceLoader.iterator(); while (result == null && iter.hasNext()) { result = iter.next().getContainer(); } // Fall-back. Also used by unit tests if (result == null) { try { @SuppressWarnings("unchecked") Class<WebSocketContainer> clazz = (Class<WebSocketContainer>) Class.forName(DEFAULT_PROVIDER_CLASS_NAME); result = clazz.getConstructor().newInstance(); } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException ignore) { // No options left. Just return null. } } return result; } protected abstract WebSocketContainer getContainer(); }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
49.79
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9