HttpHeaders
Overview
The HttpHeaders class provides access to a collection of HTTP headers represented by HttpHeader instances.
Location
- Reference: RemObjects.SDK.dll
- Namespace: RemObjects.SDK.Http
constructor
Creates a new instance of the HttpHeaders class.
constructor
HttpHeaders()
Sub New()
ContainsHeaderValue
Returns true if HTTP headers collection contains provided HTTP header.
method ContainsHeaderValue(key: String): Boolean
Boolean ContainsHeaderValue(String key)
Function ContainsHeaderValue(key As String) As Boolean
Parameters:
- key: HTTP header name
ContentType
Gets or sets MIME content type.
property ContentType: String read write;
String ContentType { get; set; }
Property ContentType() As String
Count
Gets the number of elements contained in the HTTP headers collection.
property Count: Int32 read;
Int32 Count { get; }
ReadOnly Property Count() As Int32
Create
Reads HTTP headers from the provided HTTP connection and creates a HttpHeaders instance containing these headers.
class method Create(connection: Connection): HttpHeaders
static HttpHeaders Create(Connection connection)
Shared Function Create(connection As Connection) As HttpHeaders
Parameters:
- connection: HTTP connection
FirstHeader
Gets or sets the first header in the headers collection. This header contains HTTP request or response information (f.e. HTTP method name, request path etc).
property FirstHeader: String read write;
String FirstHeader { get; set; }
Property FirstHeader() As String
GetHeaderValue
Gets the header associated with the specified name. If the header with requested name is not present in the internal collection then returns null.
method GetHeaderValue(name: String): String
String GetHeaderValue(String name)
Function GetHeaderValue(name As String) As String
Parameters:
- name: HTTP header name
HttpCode
Gets HTTP status code.
property HttpCode: HttpStatusCode read;
HttpStatusCode HttpCode { get; }
ReadOnly Property HttpCode() As HttpStatusCode
MaxHeaderLines
Gets or sets maximum HTTP header count allowed.
The default value is 100.
property MaxHeaderLines: Int32 read write;
Int32 MaxHeaderLines { get; set; }
Property MaxHeaderLines() As Int32
MaxHeaderLinesEnabled
Gets or sets flag indicating whether number of HTTP headers read should be limited by MaxHeaderLines.
The default value is true.
property MaxHeaderLinesEnabled: Boolean read write;
Boolean MaxHeaderLinesEnabled { get; set; }
Property MaxHeaderLinesEnabled() As Boolean
ParseFirstLine
Parses first HTTP header in the collection and sets properties corresponding to it (f.e. RequestType, RequestPath and RequestVersion).
method ParseFirstLine
void ParseFirstLine()
Sub ParseFirstLine()
ReadHeader
Reads HTTP headers collection from the provided HTTP connection.
method ReadHeader(connection: Connection): Boolean
Boolean ReadHeader(Connection connection)
Function ReadHeader(connection As Connection) As Boolean
Parameters:
- connection: HTTP connection
RequestPath
Gets or sets the request URL, not including the server URL.
property RequestPath: String read write;
String RequestPath { get; set; }
Property RequestPath() As String
RequestType
Gets or sets the method of the HTTP request, f.e. GET or POST.
property RequestType: String read write;
String RequestType { get; set; }
Property RequestType() As String
RequestVersion
Gets or sets the HTTP protocol version.
property RequestVersion: String read write;
String RequestVersion { get; set; }
Property RequestVersion() As String
ResponseCode obsolete
Gets HTTP status code.
Note: This property is obsolete. Use the HttpCode property instead.
property ResponseCode: Int32 read write;
Int32 ResponseCode { get; set; }
Property ResponseCode() As Int32
SetHeaderValue
Sets HTTP header value.
method SetHeaderValue(name: String; value: String)
void SetHeaderValue(String name, String value)
Sub SetHeaderValue(name As String, value As String)
Parameters:
- name: HTTP header name
- value: HTTP header value
SetRequestHeader
Composes the 1st HTTP headers line based on the provided HTTP version, HTTP method and request path.
method SetRequestHeader(version: String; requestType: String; requestPath: String)
void SetRequestHeader(String version, String requestType, String requestPath)
Sub SetRequestHeader(version As String, requestType As String, requestPath As String)
Parameters:
- version: HTTP version
- requestType: HTTP method
- requestPath: HTTP request path (w/o the server URL)
SetResponseHeader (String, Int32) obsolete
Composes the 1st HTTP headers line based on the provided HTTP version and HTTP response code.
method SetResponseHeader(version: String; code: Int32)
void SetResponseHeader(String version, Int32 code)
Sub SetResponseHeader(version As String, code As Int32)
Parameters:
- version: HTTP version
- code: HTTP response code
SetResponseHeader (String, HttpStatusCode)
Composes the 1st HTTP headers line based on the provided HTTP version and HTTP response code.
method SetResponseHeader(version: String; code: HttpStatusCode)
void SetResponseHeader(String version, HttpStatusCode code)
Sub SetResponseHeader(version As String, code As HttpStatusCode)
Parameters:
- version: HTTP version
- code: HTTP response code
ToString
Converts HTTP headers collection to a string like
GET http://wiki.remobjects.com/wiki/HttpHeaders_Class HTTP/1.1 Host: wiki.remobjects.com Connection: keep-alive
method ToString: String
String ToString()
Function ToString() As String
WriteHeader
Writes HTTP headers collection to the provided HTTP connection.
method WriteHeader(connection: Connection)
void WriteHeader(Connection connection)
Sub WriteHeader(connection As Connection)
Parameters:
- connection: HTTP connection
ContentType
Gets or sets MIME content type.
property ContentType: String read write;
String ContentType { get; set; }
Property ContentType() As String
Count
Gets the number of elements contained in the HTTP headers collection.
property Count: Int32 read;
Int32 Count { get; }
ReadOnly Property Count() As Int32
FirstHeader
Gets or sets the first header in the headers collection. This header contains HTTP request or response information (f.e. HTTP method name, request path etc).
property FirstHeader: String read write;
String FirstHeader { get; set; }
Property FirstHeader() As String
HttpCode
Gets HTTP status code.
property HttpCode: HttpStatusCode read;
HttpStatusCode HttpCode { get; }
ReadOnly Property HttpCode() As HttpStatusCode
MaxHeaderLines
Gets or sets maximum HTTP header count allowed.
The default value is 100.
property MaxHeaderLines: Int32 read write;
Int32 MaxHeaderLines { get; set; }
Property MaxHeaderLines() As Int32
MaxHeaderLinesEnabled
Gets or sets flag indicating whether number of HTTP headers read should be limited by MaxHeaderLines.
The default value is true.
property MaxHeaderLinesEnabled: Boolean read write;
Boolean MaxHeaderLinesEnabled { get; set; }
Property MaxHeaderLinesEnabled() As Boolean
RequestPath
Gets or sets the request URL, not including the server URL.
property RequestPath: String read write;
String RequestPath { get; set; }
Property RequestPath() As String
RequestType
Gets or sets the method of the HTTP request, f.e. GET or POST.
property RequestType: String read write;
String RequestType { get; set; }
Property RequestType() As String
RequestVersion
Gets or sets the HTTP protocol version.
property RequestVersion: String read write;
String RequestVersion { get; set; }
Property RequestVersion() As String
ResponseCode obsolete
Gets HTTP status code.
Note: This property is obsolete. Use the HttpCode property instead.
property ResponseCode: Int32 read write;
Int32 ResponseCode { get; set; }
Property ResponseCode() As Int32
Create
Reads HTTP headers from the provided HTTP connection and creates a HttpHeaders instance containing these headers.
class method Create(connection: Connection): HttpHeaders
static HttpHeaders Create(Connection connection)
Shared Function Create(connection As Connection) As HttpHeaders
Parameters:
- connection: HTTP connection
constructor
Creates a new instance of the HttpHeaders class.
constructor
HttpHeaders()
Sub New()
ContainsHeaderValue
Returns true if HTTP headers collection contains provided HTTP header.
method ContainsHeaderValue(key: String): Boolean
Boolean ContainsHeaderValue(String key)
Function ContainsHeaderValue(key As String) As Boolean
Parameters:
- key: HTTP header name
GetHeaderValue
Gets the header associated with the specified name. If the header with requested name is not present in the internal collection then returns null.
method GetHeaderValue(name: String): String
String GetHeaderValue(String name)
Function GetHeaderValue(name As String) As String
Parameters:
- name: HTTP header name
ParseFirstLine
Parses first HTTP header in the collection and sets properties corresponding to it (f.e. RequestType, RequestPath and RequestVersion).
method ParseFirstLine
void ParseFirstLine()
Sub ParseFirstLine()
ReadHeader
Reads HTTP headers collection from the provided HTTP connection.
method ReadHeader(connection: Connection): Boolean
Boolean ReadHeader(Connection connection)
Function ReadHeader(connection As Connection) As Boolean
Parameters:
- connection: HTTP connection
SetHeaderValue
Sets HTTP header value.
method SetHeaderValue(name: String; value: String)
void SetHeaderValue(String name, String value)
Sub SetHeaderValue(name As String, value As String)
Parameters:
- name: HTTP header name
- value: HTTP header value
SetRequestHeader
Composes the 1st HTTP headers line based on the provided HTTP version, HTTP method and request path.
method SetRequestHeader(version: String; requestType: String; requestPath: String)
void SetRequestHeader(String version, String requestType, String requestPath)
Sub SetRequestHeader(version As String, requestType As String, requestPath As String)
Parameters:
- version: HTTP version
- requestType: HTTP method
- requestPath: HTTP request path (w/o the server URL)
SetResponseHeader (String, Int32) obsolete
Composes the 1st HTTP headers line based on the provided HTTP version and HTTP response code.
method SetResponseHeader(version: String; code: Int32)
void SetResponseHeader(String version, Int32 code)
Sub SetResponseHeader(version As String, code As Int32)
Parameters:
- version: HTTP version
- code: HTTP response code
SetResponseHeader (String, HttpStatusCode)
Composes the 1st HTTP headers line based on the provided HTTP version and HTTP response code.
method SetResponseHeader(version: String; code: HttpStatusCode)
void SetResponseHeader(String version, HttpStatusCode code)
Sub SetResponseHeader(version As String, code As HttpStatusCode)
Parameters:
- version: HTTP version
- code: HTTP response code
ToString
Converts HTTP headers collection to a string like
GET http://wiki.remobjects.com/wiki/HttpHeaders_Class HTTP/1.1 Host: wiki.remobjects.com Connection: keep-alive
method ToString: String
String ToString()
Function ToString() As String
WriteHeader
Writes HTTP headers collection to the provided HTTP connection.
method WriteHeader(connection: Connection)
void WriteHeader(Connection connection)
Sub WriteHeader(connection As Connection)
Parameters:
- connection: HTTP connection