GeezerVison is showing docs.oracle.com — HttpURLConnection (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.net
Class HttpURLConnection
-
-
Constructor Summary
Constructors
| Modifier |
Constructor |
Description |
protected |
HttpURLConnection(URL u) |
Constructor for the HttpURLConnection.
|
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
| Modifier and Type |
Method |
Description |
abstract void |
disconnect() |
Indicates that other requests to the server
are unlikely in the near future.
|
InputStream |
getErrorStream() |
Returns the error stream if the connection failed
but the server sent useful data nonetheless.
|
static boolean |
getFollowRedirects() |
Returns a boolean indicating
whether or not HTTP redirects (3xx) should
be automatically followed.
|
String |
getHeaderField(int n) |
Returns the value for the nth header field.
|
long |
getHeaderFieldDate(String name,
long Default) |
Returns the value of the named field parsed as date.
|
String |
getHeaderFieldKey(int n) |
Returns the key for the nth header field.
|
boolean |
getInstanceFollowRedirects() |
Returns the value of this HttpURLConnection's
instanceFollowRedirects field.
|
Permission |
getPermission() |
Returns a SocketPermission object representing the
permission necessary to connect to the destination host and port.
|
String |
getRequestMethod() |
Get the request method.
|
int |
getResponseCode() |
Gets the status code from an HTTP response message.
|
String |
getResponseMessage() |
Gets the HTTP response message, if any, returned along with the
response code from a server.
|
void |
setChunkedStreamingMode(int chunklen) |
This method is used to enable streaming of a HTTP request body
without internal buffering, when the content length is not
known in advance.
|
void |
setFixedLengthStreamingMode(int contentLength) |
This method is used to enable streaming of a HTTP request body
without internal buffering, when the content length is known in
advance.
|
void |
setFixedLengthStreamingMode(long contentLength) |
This method is used to enable streaming of a HTTP request body
without internal buffering, when the content length is known in
advance.
|
static void |
setFollowRedirects(boolean set) |
Sets whether HTTP redirects (requests with response code 3xx) should
be automatically followed by this class.
|
void |
setInstanceFollowRedirects(boolean followRedirects) |
Sets whether HTTP redirects (requests with response code 3xx) should
be automatically followed by this HttpURLConnection
instance.
|
void |
setRequestMethod(String method) |
Set the method for the URL request, one of:
GET
POST
HEAD
OPTIONS
PUT
DELETE
TRACE
are legal, subject to protocol restrictions.
|
abstract boolean |
usingProxy() |
Indicates if the connection is going through a proxy.
|
-
Methods inherited from class java.net.URLConnection
addRequestProperty, connect, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderFieldInt, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getInputStream, getLastModified, getOutputStream, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
-
-
Field Detail
-
HTTP_SERVER_ERROR
@Deprecated
public static final int HTTP_SERVER_ERROR
Deprecated. it is misplaced and shouldn't have existed.
HTTP Status-Code 500: Internal Server Error.
- See Also:
- Constant Field Values
-
Method Detail
-
disconnect
public abstract void disconnect()
Indicates that other requests to the server
are unlikely in the near future. Calling disconnect()
should not imply that this HttpURLConnection
instance can be reused for other requests.
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|