FileDocCategorySizeDatePackage
Handler.javaAPI DocAndroid 1.5 API2997Wed May 06 22:41:04 BST 2009org.apache.harmony.luni.internal.net.www.protocol.http

Handler

public class Handler extends URLStreamHandler
This is the handler that manages all transactions between the client and a HTTP remote server.

Fields Summary
Constructors Summary
Methods Summary
protected intgetDefaultPort()
Return the default port.

        return 80;
    
protected java.net.URLConnectionopenConnection(java.net.URL u)
Returns a connection to the HTTP server specified by this URL.

param
u the URL to which the connection is pointing to
return
a connection to the resource pointed by this url.
throws
IOException if this handler fails to establish a connection

        return new HttpURLConnection(u, getDefaultPort());
    
protected java.net.URLConnectionopenConnection(java.net.URL u, java.net.Proxy proxy)
Returns a connection, which is established via the proxy, to the HTTP server specified by this URL. If the proxy is DIRECT type, the connection is made in normal way.

param
u the URL which the connection is pointing to
param
proxy the proxy which is used to make the connection
return
a connection to the resource pointed by this url.
throws
IOException if this handler fails to establish a connection.
throws
IllegalArgumentException if any argument is null or the type of proxy is wrong.
throws
UnsupportedOperationException if the protocol handler doesn't support this method.

        if (null == u || null == proxy) {
            throw new IllegalArgumentException(Msg.getString("K034b")); //$NON-NLS-1$
        }
        return new HttpURLConnection(u, getDefaultPort(), proxy);