Interface SubProtocolURLConnectionFactory

  • All Known Implementing Classes:
    CompositeSubProtocolURLConnectionFactory

    public interface SubProtocolURLConnectionFactory
    A factory for creating URLConnection instances that handle sub-protocols.

    Implementations of this interface are responsible for determining whether they can handle a specific URL and its associated sub-protocols, and for creating the appropriate connection if possible.

    Example Implementation

    {@code
     public class MySubProtocolURLConnectionFactory implements SubProtocolURLConnectionFactory {
    Since:
    1.0.0
    Author:
    Mercy
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.net.URLConnection create​(java.net.URL url, java.util.List<java.lang.String> subProtocols, java.net.Proxy proxy)
      Create the sub-protocols' URLConnection
      boolean supports​(java.net.URL url, java.util.List<java.lang.String> subProtocols)
      Supports the current factory to create the URLConnection or not
    • Method Detail

      • supports

        boolean supports​(java.net.URL url,
                         java.util.List<java.lang.String> subProtocols)
        Supports the current factory to create the URLConnection or not

        Parameters:
        url - the URL that this connects to
        subProtocols - the list of sub-protocols
        Returns:
        true if supports,otherwise false
      • create

        java.net.URLConnection create​(java.net.URL url,
                                      java.util.List<java.lang.String> subProtocols,
                                      java.net.Proxy proxy)
                               throws java.io.IOException
        Create the sub-protocols' URLConnection
        Parameters:
        url - the URL that this connects to
        subProtocols - the list of sub-protocols
        proxy - Proxy the proxy through which the connection will be made. If direct connection is desired, Proxy.NO_PROXY should be specified.
        Returns:
        URLConnection
        Throws:
        java.io.IOException - If the process is failed