Skip to content

io microsphere net CompositeURLStreamHandlerFactory

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

CompositeURLStreamHandlerFactory

Type: Class | Module: microsphere-java-core | Package: io.microsphere.net | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/net/CompositeURLStreamHandlerFactory.java

Overview

A composite URLStreamHandlerFactory that delegates the creation of URLStreamHandler instances to one or more underlying factories in a prioritized order.

This class allows combining multiple URLStreamHandlerFactory implementations into a single factory, where each factory is given a chance to create a handler for a specific protocol. The delegation order can be controlled by providing factories that implement the Prioritized interface.

Example Usage

`CompositeURLStreamHandlerFactory compositeFactory = new CompositeURLStreamHandlerFactory();

// Add custom factories
compositeFactory.addURLStreamHandlerFactory(new MyURLStreamHandlerFactory());
compositeFactory.addURLStreamHandlerFactory(new AnotherURLStreamHandlerFactory());

// Set as the default URL stream handler factory
URL.setURLStreamHandlerFactory(compositeFactory);
`

Declaration

public class CompositeURLStreamHandlerFactory implements URLStreamHandlerFactory

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

CompositeURLStreamHandlerFactory compositeFactory = new CompositeURLStreamHandlerFactory();

// Add custom factories
compositeFactory.addURLStreamHandlerFactory(new MyURLStreamHandlerFactory());
compositeFactory.addURLStreamHandlerFactory(new AnotherURLStreamHandlerFactory());

// Set as the default URL stream handler factory
URL.setURLStreamHandlerFactory(compositeFactory);

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.net.CompositeURLStreamHandlerFactory;

API Reference

Public Methods

Method Description
createURLStreamHandler
addURLStreamHandlerFactory Add URLStreamHandlerFactory

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally