Module java.base
Package java.net

Class HttpURLConnection

java.lang.Object
java.net.URLConnection
java.net.HttpURLConnection
Direct Known Subclasses:
HttpsURLConnection

public abstract class HttpURLConnection extends URLConnection
A URLConnection with support for HTTP-specific features. See the spec for details.

Each HttpURLConnection instance is used to make a single request but the underlying network connection to the HTTP server may be transparently shared by other instances. Calling the close() methods on the InputStream or OutputStream of an HttpURLConnection after a request may free network resources associated with this instance but has no effect on any shared persistent connection. Calling the disconnect() method may close the underlying socket if a persistent connection is otherwise idle at that time.

The HTTP protocol handler has a few settings that can be accessed through System Properties. This covers Proxy settings as well as various other settings.

Security permissions

If a security manager is installed, and if a method is called which results in an attempt to open a connection, the caller must possess either:

If automatic redirection is enabled, and this request is redirected to another destination, then the caller must also have permission to connect to the redirected host/URL.

Since:
1.1
See Also: