Register a {@literal 'java.protocol.handler.pkgs'} property so that a
{@link URLStreamHandler} will be located to deal with jar URLs.
179074
public static void registerUrlProtocolHandler() {
        String handlers = System.getProperty(PROTOCOL_HANDLER, "");
        System.setProperty(PROTOCOL_HANDLER, ("".equals(handlers) ? HANDLERS_PACKAGE
                : handlers + "|" + HANDLERS_PACKAGE));
        resetCachedUrlHandlers();
    }
1199175
@Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry
                .addResourceHandler("/rs/**")
                .addResourceLocations("/rs/");
        registry
                .addResourceHandler("/webjars/**")
                .addResourceLocations("/webjars/")
                .resourceChain(true);
    }
398719
public static void attachHandler (
        String protocol, Class<? extends URLStreamHandler> handlerClass)
    {
        // set up the factory.
        if (_handlers == null) {
            _handlers = new HashMap<String,Class<? extends URLStreamHandler>>();

            // There are two ways to do this.

            // Method 1, which is the only one that seems to work under
            // Java Web Start, is to register a factory. This can throw an
            // Error if another factory is already registered. We let that
            // error bubble on back.
            URL.setURLStreamHandlerFactory(new AttachableURLFactory());

            // Method 2 seems like a better idea but doesn't work under
            // Java Web Start. We add on a property that registers this
            // very class as the handler for the resource property. It
            // would be instantiated with Class.forName().
            // (And I did check, it's not dasho that is preventing this
            // from working under JWS, it's something else.)
            /*
            // dug up from java.net.URL
            String HANDLER_PROP = "java.protocol.handler.pkgs";

            String prop = System.getProperty(HANDLER_PROP, "");
            if (!"".equals(prop)) {
            prop += "|";
            }
            prop += "com.threerings";
            System.setProperty(HANDLER_PROP, prop);
            */
        }

        _handlers.put(protocol.toLowerCase(), handlerClass);
    }
1225177
@VisibleForTesting
  static void register(SpanExporter spanExporter, Handler handler) {
    ZipkinTraceExporter.register(spanExporter, handler);
  }
405138
public void register(String pattern, HttpRequestHandler handler) {
        registry.register(pattern, handler);
        registry.register(pattern + "/", handler);
    }
8627
public static void register(final Server s) {
        final ServletHolder sh = new ServletHolder(ServletContainer.class);
        sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
            "com.sun.jersey.api.core.PackagesResourceConfig");
        sh.setInitParameter("com.sun.jersey.config.property.packages", "org.jaxrx.resource");

        new Context(s, "/", Context.SESSIONS).addServlet(sh, "/");
    }
1194520
private static void registerSSLProtocolHandler() {
        String list = System.getProperty( PROTOCOL_HANDLER_PKGS );
        if (list == null || list.length() == 0) {
            System.setProperty( PROTOCOL_HANDLER_PKGS, SSL_PROTOCOL_HANDLER );
        } else if (list.indexOf( SSL_PROTOCOL_HANDLER ) < 0) {
        	// [ 1516007 ] Default SSL provider not being used
          System.setProperty( PROTOCOL_HANDLER_PKGS, list + " | " + SSL_PROTOCOL_HANDLER );
        }
    }
1286679
void register(String type, BiConsumer<ProtocolRequest, ServerConnection> handler) {
    handlers.put(type, handler);
  }
438570
public static void registerXMLBindingClassForPropGetSetMethod(final Class<?> cls) {
        if (registeredXMLBindingClassList.containsKey(cls)) {
            return;
        }

        synchronized (entityDeclaredPropGetMethodPool) {
            registeredXMLBindingClassList.put(cls, false);

            if (entityDeclaredPropGetMethodPool.containsKey(cls)) {
                entityDeclaredPropGetMethodPool.remove(cls);
                entityDeclaredPropSetMethodPool.remove(cls);

                entityPropFieldPool.remove(cls);
                loadPropGetSetMethodList(cls);
            }
        }
    }
91991
protected URL resolveHandlerChainFileName(String clzName, String fileName) {
        URL handlerFile = null;
        InputStream in = null;

        String handlerChainFileName = fileName;
        URL baseUrl = classLoader.getResource(getClassResourceName(clzName));

        try {
            //if the filename start with '/', then find and return the resource under the web application home directory directory.
            if (handlerChainFileName.charAt(0) == '/') {
                return classLoader.getResource(handlerChainFileName.substring(1));
            }

            //otherwise, create a new url instance according to the baseurl and the fileName
            handlerFile = new URL(baseUrl, handlerChainFileName);
            in = handlerFile.openStream();
        } catch (Exception e) {
            // log the error msg
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (Exception e) {
                }
            }
        }
        return handlerFile;
    }
89131
public static void add() {

        String current = System.getProperties().getProperty(HANDLER_PKGS, "");
        if (current.length() > 0) {
            if (current.contains(PKG)) {
                return;
            }
            current = current + "|";
        }
        System.getProperties().put(HANDLER_PKGS, current + PKG);

    }
1209565
private ServletHandler configureHandler(String servletClassName) {
        ServletHandler handler = new ServletHandler();
        handler.addServletWithMapping(servletClassName, "/*");
        return handler;
    }
754231
final void addHandler(final HttpHandler handler) {
    if (handler != null) {
      if (!eventHandlers.containsKey(handler.getUriSpecification().toLowerCase())) {
        eventHandlers.put(handler.getUriSpecification().toLowerCase(), handler);
      } else {
        LOG.log(Level.WARNING, "JettyHandler handle is already registered: {0} ", handler.getUriSpecification());
      }
    }
  }
879381
private void register(PathMapping pathMapping) throws IOException {

		GeneratorRegistry generatorRegistry = bundlesHandler.getConfig().getGeneratorRegistry();
		List<PathMapping> mappings = new ArrayList<>();
		if (generatorRegistry.isPathGenerated(pathMapping.getPath())) {
			List<PathMapping> genPathMappings = generatorRegistry.getGeneratedPathMappings(pathMapping.getBundle(),
					pathMapping.getPath(), rsReader);
			if (genPathMappings != null) {
				mappings.addAll(genPathMappings);
			} else {
				mappings.add(pathMapping);
			}
		} else {
			mappings.add(pathMapping);
		}

		for (PathMapping pMapping : mappings) {
			String filePath = rsReader.getFilePath(pMapping.getPath());
			registerPathMapping(pMapping, filePath);
		}
	}
892478
synchronized String registerHandle(AbstractAppHandle handle) {
    String secret = createSecret();
    secretToPendingApps.put(secret, handle);
    return secret;
  }
894265
public URLStreamHandler createURLStreamHandler (String protocol)
    {
        Class<? extends URLStreamHandler> handler = _handlers.get(protocol.toLowerCase());
        if (handler != null) {
            try {
                return handler.newInstance();
            } catch (Exception e) {
                log.warning("Unable to instantiate URLStreamHandler", "protocol", protocol,
                            "cause", e);
            }
        }
        return null;
    }
1028189
public static void addToClasspath(final URL url, final ClassLoader classLoader) {
        checkNotNull("url", url);
        checkNotNull("classLoader", classLoader);
        if (!(classLoader instanceof URLClassLoader)) {
            throw new IllegalArgumentException("Cannot add '" + url + "' to classloader because it's not an URL classloader");
        }
        final URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
        if (!containsURL(urlClassLoader.getURLs(), url)) {
            try {

                final Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { URL.class });
                addURL.setAccessible(true);
                addURL.invoke(urlClassLoader, new Object[] { url });
            } catch (final NoSuchMethodException e) {
                throw new RuntimeException(e);
            } catch (final IllegalArgumentException e) {
                throw new RuntimeException(e);
            } catch (final IllegalAccessException e) {
                throw new RuntimeException(e);
            } catch (final InvocationTargetException e) {
                throw new RuntimeException(e);
            }
        }
    }