Package io.microsphere.net
Interface SubProtocolURLConnectionFactory
-
- All Known Implementing Classes:
CompositeSubProtocolURLConnectionFactory
public interface SubProtocolURLConnectionFactoryA factory for creatingURLConnectioninstances 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 Usage
{@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.URLConnectioncreate(java.net.URL url, java.util.List<java.lang.String> subProtocols, java.net.Proxy proxy)Create the sub-protocols'URLConnectionbooleansupports(java.net.URL url, java.util.List<java.lang.String> subProtocols)Supports the current factory to create theURLConnectionor not
-
-
-
Method Detail
-
supports
boolean supports(java.net.URL url, java.util.List<java.lang.String> subProtocols)Supports the current factory to create theURLConnectionor not- Parameters:
url- the URL that this connects tosubProtocols- the list of sub-protocols- Returns:
trueif supports,otherwisefalse
-
create
java.net.URLConnection create(java.net.URL url, java.util.List<java.lang.String> subProtocols, java.net.Proxy proxy) throws java.io.IOExceptionCreate the sub-protocols'URLConnection- Parameters:
url- the URL that this connects tosubProtocols- the list of sub-protocolsproxy-Proxythe 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
-
-