HttpClientResponse

Overview

The HttpClientResponse class represents an HTTP repsonse received on the client side. This class is descended from the HttpOutgoingRequestResponse class and adds some client-side specific properties and methods.

The HttpClientResponse class is used internally by the IpHttpClientChannel and IpSuperHttpClientChannel Remoting SDK client channels.

Location


 

constructor  protected    (declared in HttpRequestResponse)

 

constructor

 

HttpClientResponse()

 

Sub New()

constructor (Connection, HttpHeaders)  protected

Creates a new instance of the HttpClientResponse class.

 

constructor(connection: Connection; headers: HttpHeaders)

 

HttpClientResponse(Connection connection, HttpHeaders headers)

 

Sub New(connection As Connection, headers As HttpHeaders)

Parameters:

  • connection: Client connection
  • headers: Collection of the HTTP headers that were received from the server

constructor (HttpHeaders)  protected    (declared in HttpRequestResponse)

 

constructor(header: HttpHeaders)

 

HttpClientResponse(HttpHeaders header)

 

Sub New(header As HttpHeaders)

Parameters:

  • header:

Chunked    (declared in HttpIncomingRequestResponse)

 

property Chunked: Boolean read;

 

Boolean Chunked { get; }

 

ReadOnly Property Chunked() As Boolean

Client  protected

Gets a flag indicating whether this class is used in a client application.

The value of this property is always true.

 

property Client: Boolean read;

 

Boolean Client { get; }

 

ReadOnly Property Client() As Boolean

CloneEvents    (declared in HttpRequestResponse)

 

method CloneEvents(source: HttpRequestResponse)

 

void CloneEvents(HttpRequestResponse source)

 

Sub CloneEvents(source As HttpRequestResponse)

Parameters:

  • source:

Code obsolete

Gets the HTTP Result code received from the server.

Note: It is recommended to use the HttpCode property to access the HTTP Result code

 

property Code: Int32 read;

 

Int32 Code { get; }

 

ReadOnly Property Code() As Int32

ContentBytes    (declared in HttpIncomingRequestResponse)

Returns the HTTP body in form of a byte array.

Note that this method is not as efficient as the ContentStream method, as the entire body will be read into a memory buffer at once.

 

property ContentBytes: array of Byte read;

 

Byte[] ContentBytes { get; }

 

ReadOnly Property ContentBytes() As Byte()

ContentLength    (declared in HttpIncomingRequestResponse)

Contains the ContentLength header value reveived from the remote side. If the remot did not provide a length (for example in HTTP 1.0 scenarios, or if Keep-Alive is not supported), accessing the property will raise an exception.

Use the HasContentLength property to determine if a valid ContentLength has been received.

 

property ContentLength: Int32 read;

 

Int32 ContentLength { get; }

 

ReadOnly Property ContentLength() As Int32

ContentStream    (declared in HttpIncomingRequestResponse)

Returns a Stream object with the HTTP body of the received request (server) or response (client).

This object is a HttpIncomingStream, which provides direct access to the underling DataConnection, but is (at leats for HTTP 1.1) limited to the number of bytes indicated by the HTTP header. As such, the same limitations as for the Connection stream class apply, you can only rad it once and forward-only, and it does not support seeking or writing.

Because ContentStream provides you with direct access to the underlying Connection Stream, it is the fastest and most efficient way to access the response (as opposed to ContentString and ContentBytes, both of which involve copying the entire data from the stream into a memory buffer).

Note also, that you can easily use ContentStream to access and process even very large HTTP bodies (such as a huge file download), without the need to comy the entire body into memory, and without having to wait for the entire download to have finished before you can start processing it.

 

property ContentStream: Stream read;

 

Stream ContentStream { get; }

 

ReadOnly Property ContentStream() As Stream

ContentString    (declared in HttpIncomingRequestResponse)

Returns the HTTP body in form of a String object.

Note that this method is the least efficient for accessing the HTTP body, as the entire body will first be read into a memory buffer (then accessible via ContentBytes), and then converted into a string by the assigned Encoding (Encoding.ASCII by default).

 

property ContentString: String read;

 

String ContentString { get; }

 

ReadOnly Property ContentString() As String

DataConnection    (declared in HttpIncomingRequestResponse)

 

property DataConnection: Connection read;

 

Connection DataConnection { get; }

 

ReadOnly Property DataConnection() As Connection

Dispose

Releases resources used by the current instance, in particular the disposed HHTP connection instance that was provided as a constructor parameter earlier.

 

method Dispose

 

void Dispose()

 

Sub Dispose()

Encoding    (declared in HttpRequestResponse)

 

property Encoding: Encoding read write;

 

Encoding Encoding { get; set; }

 

Property Encoding() As Encoding

FlushContent    (declared in HttpIncomingRequestResponse)

 

method FlushContent: Boolean

 

Boolean FlushContent()

 

Function FlushContent() As Boolean

HasContentLength    (declared in HttpIncomingRequestResponse)

Specifies whether the HTTP header provides a ContentLength field.

 

property HasContentLength: Boolean read;

 

Boolean HasContentLength { get; }

 

ReadOnly Property HasContentLength() As Boolean

HasOnTransferProgress  protected    (declared in HttpRequestResponse)

 

property HasOnTransferProgress: Boolean read;

 

Boolean HasOnTransferProgress { get; }

 

ReadOnly Property HasOnTransferProgress() As Boolean

 

property Header: HttpHeaders read write;

 

HttpHeaders Header { get; set; }

 

Property Header() As HttpHeaders

HttpCode

Gets the HTTP Result code received from the server.

Note: It is recommended to use the HttpCode property to access the HTTP Result code

 

property HttpCode: HttpStatusCode read;

 

HttpStatusCode HttpCode { get; }

 

ReadOnly Property HttpCode() As HttpStatusCode

KeepAlive    (declared in HttpIncomingRequestResponse)

 

property KeepAlive: Boolean read;

 

Boolean KeepAlive { get; }

 

ReadOnly Property KeepAlive() As Boolean

OnTransferEnd    (declared in HttpRequestResponse)

 

event OnTransferEnd: EventHandler<TransferEndEventArgs>;

 

delegate EventHandler<TransferEndEventArgs> OnTransferEnd()

 

Event OnTransferEnd As EventHandler<TransferEndEventArgs>

OnTransferProgress    (declared in HttpRequestResponse)

 

event OnTransferProgress: EventHandler<TransferProgressEventArgs>;

 

delegate EventHandler<TransferProgressEventArgs> OnTransferProgress()

 

Event OnTransferProgress As EventHandler<TransferProgressEventArgs>

OnTransferStart    (declared in HttpRequestResponse)

 

event OnTransferStart: EventHandler<TransferStartEventArgs>;

 

delegate EventHandler<TransferStartEventArgs> OnTransferStart()

 

Event OnTransferStart As EventHandler<TransferStartEventArgs>

Server  protected

Gets a flag indicating whether this class is used in a server application.

The value of this property is always false.

 

property Server: Boolean read;

 

Boolean Server { get; }

 

ReadOnly Property Server() As Boolean

TriggerOnTransferEnd  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferEnd(direction: TransferDirection)

 

void TriggerOnTransferEnd(TransferDirection direction)

 

Sub TriggerOnTransferEnd(direction As TransferDirection)

Parameters:

  • direction:

TriggerOnTransferProgress  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferProgress(direction: TransferDirection; position: Int64)

 

void TriggerOnTransferProgress(TransferDirection direction, Int64 position)

 

Sub TriggerOnTransferProgress(direction As TransferDirection, position As Int64)

Parameters:

  • direction:
  • position:

TriggerOnTransferStart  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferStart(direction: TransferDirection; size: Int64)

 

void TriggerOnTransferStart(TransferDirection direction, Int64 size)

 

Sub TriggerOnTransferStart(direction As TransferDirection, size As Int64)

Parameters:

  • direction:
  • size:

Validate    (declared in HttpIncomingRequestResponse)

 

method Validate

 

void Validate()

 

Sub Validate()

 

Chunked    (declared in HttpIncomingRequestResponse)

 

property Chunked: Boolean read;

 

Boolean Chunked { get; }

 

ReadOnly Property Chunked() As Boolean

Client  protected

Gets a flag indicating whether this class is used in a client application.

The value of this property is always true.

 

property Client: Boolean read;

 

Boolean Client { get; }

 

ReadOnly Property Client() As Boolean

Code obsolete

Gets the HTTP Result code received from the server.

Note: It is recommended to use the HttpCode property to access the HTTP Result code

 

property Code: Int32 read;

 

Int32 Code { get; }

 

ReadOnly Property Code() As Int32

ContentBytes    (declared in HttpIncomingRequestResponse)

Returns the HTTP body in form of a byte array.

Note that this method is not as efficient as the ContentStream method, as the entire body will be read into a memory buffer at once.

 

property ContentBytes: array of Byte read;

 

Byte[] ContentBytes { get; }

 

ReadOnly Property ContentBytes() As Byte()

ContentLength    (declared in HttpIncomingRequestResponse)

Contains the ContentLength header value reveived from the remote side. If the remot did not provide a length (for example in HTTP 1.0 scenarios, or if Keep-Alive is not supported), accessing the property will raise an exception.

Use the HasContentLength property to determine if a valid ContentLength has been received.

 

property ContentLength: Int32 read;

 

Int32 ContentLength { get; }

 

ReadOnly Property ContentLength() As Int32

ContentStream    (declared in HttpIncomingRequestResponse)

Returns a Stream object with the HTTP body of the received request (server) or response (client).

This object is a HttpIncomingStream, which provides direct access to the underling DataConnection, but is (at leats for HTTP 1.1) limited to the number of bytes indicated by the HTTP header. As such, the same limitations as for the Connection stream class apply, you can only rad it once and forward-only, and it does not support seeking or writing.

Because ContentStream provides you with direct access to the underlying Connection Stream, it is the fastest and most efficient way to access the response (as opposed to ContentString and ContentBytes, both of which involve copying the entire data from the stream into a memory buffer).

Note also, that you can easily use ContentStream to access and process even very large HTTP bodies (such as a huge file download), without the need to comy the entire body into memory, and without having to wait for the entire download to have finished before you can start processing it.

 

property ContentStream: Stream read;

 

Stream ContentStream { get; }

 

ReadOnly Property ContentStream() As Stream

ContentString    (declared in HttpIncomingRequestResponse)

Returns the HTTP body in form of a String object.

Note that this method is the least efficient for accessing the HTTP body, as the entire body will first be read into a memory buffer (then accessible via ContentBytes), and then converted into a string by the assigned Encoding (Encoding.ASCII by default).

 

property ContentString: String read;

 

String ContentString { get; }

 

ReadOnly Property ContentString() As String

DataConnection    (declared in HttpIncomingRequestResponse)

 

property DataConnection: Connection read;

 

Connection DataConnection { get; }

 

ReadOnly Property DataConnection() As Connection

Encoding    (declared in HttpRequestResponse)

 

property Encoding: Encoding read write;

 

Encoding Encoding { get; set; }

 

Property Encoding() As Encoding

HasContentLength    (declared in HttpIncomingRequestResponse)

Specifies whether the HTTP header provides a ContentLength field.

 

property HasContentLength: Boolean read;

 

Boolean HasContentLength { get; }

 

ReadOnly Property HasContentLength() As Boolean

HasOnTransferProgress  protected    (declared in HttpRequestResponse)

 

property HasOnTransferProgress: Boolean read;

 

Boolean HasOnTransferProgress { get; }

 

ReadOnly Property HasOnTransferProgress() As Boolean

 

property Header: HttpHeaders read write;

 

HttpHeaders Header { get; set; }

 

Property Header() As HttpHeaders

HttpCode

Gets the HTTP Result code received from the server.

Note: It is recommended to use the HttpCode property to access the HTTP Result code

 

property HttpCode: HttpStatusCode read;

 

HttpStatusCode HttpCode { get; }

 

ReadOnly Property HttpCode() As HttpStatusCode

KeepAlive    (declared in HttpIncomingRequestResponse)

 

property KeepAlive: Boolean read;

 

Boolean KeepAlive { get; }

 

ReadOnly Property KeepAlive() As Boolean

Server  protected

Gets a flag indicating whether this class is used in a server application.

The value of this property is always false.

 

property Server: Boolean read;

 

Boolean Server { get; }

 

ReadOnly Property Server() As Boolean

 

constructor  protected    (declared in HttpRequestResponse)

 

constructor

 

HttpClientResponse()

 

Sub New()

constructor (Connection, HttpHeaders)  protected

Creates a new instance of the HttpClientResponse class.

 

constructor(connection: Connection; headers: HttpHeaders)

 

HttpClientResponse(Connection connection, HttpHeaders headers)

 

Sub New(connection As Connection, headers As HttpHeaders)

Parameters:

  • connection: Client connection
  • headers: Collection of the HTTP headers that were received from the server

constructor (HttpHeaders)  protected    (declared in HttpRequestResponse)

 

constructor(header: HttpHeaders)

 

HttpClientResponse(HttpHeaders header)

 

Sub New(header As HttpHeaders)

Parameters:

  • header:

CloneEvents    (declared in HttpRequestResponse)

 

method CloneEvents(source: HttpRequestResponse)

 

void CloneEvents(HttpRequestResponse source)

 

Sub CloneEvents(source As HttpRequestResponse)

Parameters:

  • source:

Dispose

Releases resources used by the current instance, in particular the disposed HHTP connection instance that was provided as a constructor parameter earlier.

 

method Dispose

 

void Dispose()

 

Sub Dispose()

FlushContent    (declared in HttpIncomingRequestResponse)

 

method FlushContent: Boolean

 

Boolean FlushContent()

 

Function FlushContent() As Boolean

TriggerOnTransferEnd  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferEnd(direction: TransferDirection)

 

void TriggerOnTransferEnd(TransferDirection direction)

 

Sub TriggerOnTransferEnd(direction As TransferDirection)

Parameters:

  • direction:

TriggerOnTransferProgress  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferProgress(direction: TransferDirection; position: Int64)

 

void TriggerOnTransferProgress(TransferDirection direction, Int64 position)

 

Sub TriggerOnTransferProgress(direction As TransferDirection, position As Int64)

Parameters:

  • direction:
  • position:

TriggerOnTransferStart  protected    (declared in HttpRequestResponse)

 

method TriggerOnTransferStart(direction: TransferDirection; size: Int64)

 

void TriggerOnTransferStart(TransferDirection direction, Int64 size)

 

Sub TriggerOnTransferStart(direction As TransferDirection, size As Int64)

Parameters:

  • direction:
  • size:

Validate    (declared in HttpIncomingRequestResponse)

 

method Validate

 

void Validate()

 

Sub Validate()

 

OnTransferEnd    (declared in HttpRequestResponse)

 

event OnTransferEnd: EventHandler<TransferEndEventArgs>;

 

delegate EventHandler<TransferEndEventArgs> OnTransferEnd()

 

Event OnTransferEnd As EventHandler<TransferEndEventArgs>

OnTransferProgress    (declared in HttpRequestResponse)

 

event OnTransferProgress: EventHandler<TransferProgressEventArgs>;

 

delegate EventHandler<TransferProgressEventArgs> OnTransferProgress()

 

Event OnTransferProgress As EventHandler<TransferProgressEventArgs>

OnTransferStart    (declared in HttpRequestResponse)

 

event OnTransferStart: EventHandler<TransferStartEventArgs>;

 

delegate EventHandler<TransferStartEventArgs> OnTransferStart()

 

Event OnTransferStart As EventHandler<TransferStartEventArgs>