HttpURLConnection HttpURLConnection Class

Definition

An URLConnection for HTTP () used to send and receive data over the web.

[Android.Runtime.Register("java/net/HttpURLConnection", ApiSince=1, DoNotGenerateAcw=true)]
public abstract class HttpURLConnection : Java.Net.URLConnection
type HttpURLConnection = class
    inherit URLConnection
Inheritance
HttpURLConnectionHttpURLConnection
Derived
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

HttpURLConnection(IntPtr, JniHandleOwnership) HttpURLConnection(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

HttpURLConnection(URL) HttpURLConnection(URL)

Constructs a new HttpURLConnection instance pointing to the resource specified by the url.

Fields

HttpAccepted HttpAccepted

Numeric status code, 202: Accepted

HttpBadGateway HttpBadGateway

Numeric status code, 502: Bad Gateway

HttpBadMethod HttpBadMethod

Numeric status code, 405: Bad Method

HttpBadRequest HttpBadRequest

Numeric status code, 400: Bad Request

HttpClientTimeout HttpClientTimeout

Numeric status code, 408: Client Timeout

HttpConflict HttpConflict

Numeric status code, 409: Conflict

HttpCreated HttpCreated

Numeric status code, 201: Created

HttpEntityTooLarge HttpEntityTooLarge

Numeric status code, 413: Entity too large

HttpForbidden HttpForbidden

Numeric status code, 403: Forbidden

HttpGatewayTimeout HttpGatewayTimeout

Numeric status code, 504: Gateway timeout

HttpGone HttpGone

Numeric status code, 410: Gone

HttpInternalError HttpInternalError

Numeric status code, 500: Internal error

HttpLengthRequired HttpLengthRequired

Numeric status code, 411: Length required

HttpMovedPerm HttpMovedPerm

Numeric status code, 301 Moved permanently

HttpMovedTemp HttpMovedTemp

Numeric status code, 302: Moved temporarily

HttpMultChoice HttpMultChoice

Numeric status code, 300: Multiple choices

HttpNoContent HttpNoContent

Numeric status code, 204: No content

HttpNotAcceptable HttpNotAcceptable

Numeric status code, 406: Not acceptable

HttpNotAuthoritative HttpNotAuthoritative

Numeric status code, 203: Not authoritative

HttpNotFound HttpNotFound

Numeric status code, 404: Not found

HttpNotImplemented HttpNotImplemented

Numeric status code, 501: Not implemented

HttpNotModified HttpNotModified

Numeric status code, 304: Not modified

HttpOk HttpOk

Numeric status code, 200: OK

HttpPartial HttpPartial

Numeric status code, 206: Partial

HttpPaymentRequired HttpPaymentRequired

Numeric status code, 402: Payment required

HttpPreconFailed HttpPreconFailed

Numeric status code, 412: Precondition failed

HttpProxyAuth HttpProxyAuth

Numeric status code, 407: Proxy authentication required

HttpReqTooLong HttpReqTooLong

Numeric status code, 414: Request too long

HttpReset HttpReset

Numeric status code, 205: Reset

HttpSeeOther HttpSeeOther

Numeric status code, 303: See other

HttpServerError HttpServerError

Numeric status code, 500: Internal error

HttpUnauthorized HttpUnauthorized

Numeric status code, 401: Unauthorized

HttpUnavailable HttpUnavailable

Numeric status code, 503: Unavailable

HttpUnsupportedType HttpUnsupportedType

Numeric status code, 415: Unsupported type

HttpUseProxy HttpUseProxy

Numeric status code, 305: Use proxy.

HttpVersion HttpVersion

Numeric status code, 505: Version not supported

Properties

AllowUserInteraction AllowUserInteraction

Returns allowUserInteraction.

(Inherited from URLConnection)
ChunkLength ChunkLength

If the HTTP chunked encoding is enabled this parameter defines the chunk-length.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
Connected Connected

Specifies whether this URLConnection is already connected to the remote resource.

(Inherited from URLConnection)
ConnectTimeout ConnectTimeout

Returns the connect timeout in milliseconds.

(Inherited from URLConnection)
Content Content

Returns an object representing the content of the resource this URLConnection is connected to.

(Inherited from URLConnection)
ContentEncoding ContentEncoding

Returns the content encoding type specified by the response header field content-encoding or null if this field is not set.

(Inherited from URLConnection)
ContentLength ContentLength

Returns the content length in bytes specified by the response header field content-length or -1 if this field is not set or cannot be represented as an int.

(Inherited from URLConnection)
ContentLengthLong ContentLengthLong Inherited from URLConnection
ContentType ContentType

Returns the MIME-type of the content specified by the response header field content-type or null if type is unknown.

(Inherited from URLConnection)
Date Date

Returns the timestamp when this response has been sent as a date in milliseconds since January 1, 1970 GMT or 0 if this timestamp is unknown.

(Inherited from URLConnection)
DefaultUseCaches DefaultUseCaches

Returns the default setting whether this connection allows using caches.

(Inherited from URLConnection)
DoInput DoInput

Returns the value of the option doInput which specifies whether this connection allows to receive data.

(Inherited from URLConnection)
DoOutput DoOutput

Returns the value of the option doOutput which specifies whether this connection allows to send data.

(Inherited from URLConnection)
ErrorStream ErrorStream

Returns an input stream from the server in the case of an error such as the requested file has not been found on the remote server.

Expiration Expiration

Returns the timestamp when this response will be expired in milliseconds since January 1, 1970 GMT or 0 if this timestamp is unknown.

(Inherited from URLConnection)
FixedContentLength FixedContentLength

The byte count in the request body if it is both known and streamed; and -1 otherwise.

FixedContentLengthLong FixedContentLengthLong

The byte count in the request body if it is both known and streamed; and -1 otherwise.

FollowRedirects FollowRedirects

Returns the value of followRedirects which indicates if this connection follows a different URL redirected by the server.

Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
HeaderFields HeaderFields

Returns an unmodifiable map of the response-header fields and values.

(Inherited from URLConnection)
IfModifiedSince IfModifiedSince

Returns the point of time since when the data must be modified to be transmitted.

(Inherited from URLConnection)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
InputStream InputStream

Returns an InputStream for reading data from the resource pointed by this URLConnection.

(Inherited from URLConnection)
InstanceFollowRedirects InstanceFollowRedirects

Returns whether this connection follows redirects.

JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
LastModified LastModified

Returns the value of the response header field last-modified or 0 if this value is not set.

(Inherited from URLConnection)
Method Method

The HTTP request method of this HttpURLConnection.

OutputStream OutputStream

Returns an OutputStream for writing data to this URLConnection.

(Inherited from URLConnection)
PeerReference PeerReference Inherited from Object
Permission Permission

Returns a Permission object representing all needed permissions to open this connection.

(Inherited from URLConnection)
ReadTimeout ReadTimeout

Returns the read timeout in milliseconds, or 0 if reads never timeout.

(Inherited from URLConnection)
RequestMethod RequestMethod

Returns the request method which will be used to make the request to the remote HTTP server.

RequestProperties RequestProperties

Returns an unmodifiable map of general request properties used by this connection.

(Inherited from URLConnection)
ResponseCode ResponseCode

Returns the response code returned by the remote HTTP server.

ResponseMessage ResponseMessage

Returns the response message returned by the remote HTTP server.

ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

URL URL

Returns the URL represented by this URLConnection.

(Inherited from URLConnection)
Url Url

The URL which represents the remote target of this URLConnection.

(Inherited from URLConnection)
UseCaches UseCaches

Returns the value of the flag which specifies whether this URLConnection allows to use caches.

(Inherited from URLConnection)

Methods

AddRequestProperty(String, String) AddRequestProperty(String, String)

Adds the given property to the request header.

(Inherited from URLConnection)
Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
Connect() Connect()

Opens a connection to the resource.

(Inherited from URLConnection)
ConnectAsync() ConnectAsync() Inherited from URLConnection
Disconnect() Disconnect()

Releases this connection so that its resources may be either reused or closed.

Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
GetContent(Class[]) GetContent(Class[])

Returns an object representing the content of the resource this URLConnection is connected to.

(Inherited from URLConnection)
GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetHeaderField(Int32) GetHeaderField(Int32)

Returns the header value at the field position pos or null if the header has fewer than pos fields.

(Inherited from URLConnection)
GetHeaderField(String) GetHeaderField(String)

Returns the value of the header field specified by key or null if there is no field with this name.

(Inherited from URLConnection)
GetHeaderFieldDate(String, Int64) GetHeaderFieldDate(String, Int64)

Returns the specified header value as a date in milliseconds since January 1, 1970 GMT.

(Inherited from URLConnection)
GetHeaderFieldInt(String, Int32) GetHeaderFieldInt(String, Int32)

Returns the specified header value as a number.

(Inherited from URLConnection)
GetHeaderFieldKey(Int32) GetHeaderFieldKey(Int32)

Returns the name of the header field at the given position posn or null if there are fewer than posn fields.

(Inherited from URLConnection)
GetHeaderFieldLong(String, Int64) GetHeaderFieldLong(String, Int64) Inherited from URLConnection
GetRequestProperty(String) GetRequestProperty(String)

Returns the value of the request header property specified by {code field} or null if there is no field with this name.

(Inherited from URLConnection)
JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
SetChunkedStreamingMode(Int32) SetChunkedStreamingMode(Int32)

Stream a request body whose length is not known in advance.

SetFixedLengthStreamingMode(Int32) SetFixedLengthStreamingMode(Int32)

Equivalent to setFixedLengthStreamingMode((long) contentLength), but available on earlier versions of Android and limited to 2 GiB.

SetFixedLengthStreamingMode(Int64) SetFixedLengthStreamingMode(Int64)

Configures this connection to stream the request body with the known fixed byte count of contentLength.

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetRequestProperty(String, String) SetRequestProperty(String, String)

Sets the value of the specified request header field.

(Inherited from URLConnection)
ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
UsingProxy() UsingProxy()

Returns whether this connection uses a proxy server or not.

Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to