Package io.microsphere.net
Interface SubProtocolURLConnectionFactory
-
- All Known Implementing Classes:
CompositeSubProtocolURLConnectionFactory
public interface SubProtocolURLConnectionFactory
A factory for creatingURLConnection
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 theURLConnection
or not
-
-
-
Method Detail
-
supports
boolean supports(java.net.URL url, java.util.List<java.lang.String> subProtocols)
Supports the current factory to create theURLConnection
or not- Parameters:
url
- the URL that this connects tosubProtocols
- the list of sub-protocols- Returns:
true
if 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.IOException
Create the sub-protocols'URLConnection
- Parameters:
url
- the URL that this connects tosubProtocols
- the list of sub-protocolsproxy
-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
-
-