C# Class ServiceStack.HttpUtils

Afficher le fichier Open project: CSGOpenSource/ServiceStack.Text Class Usage Examples

Méthodes publiques

Méthode Description
AddHashParam ( this url, string key, object val ) : string
AddHashParam ( this url, string key, string val ) : string
AddQueryParam ( this url, object key, string val, bool encode = true ) : string
AddQueryParam ( this url, string key, object val, bool encode = true ) : string
AddQueryParam ( this url, string key, string val, bool encode = true ) : string
DeleteFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
GetBytesFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : byte[]
GetErrorResponse ( this url ) : HttpWebResponse
GetJsonFromUrl ( this url, Action requestFilter = null, Action responseFilter = null ) : string
GetResponseBody ( this ex ) : string
GetResponseStatus ( this url ) : HttpStatusCode?
GetStatus ( this ex ) : HttpStatusCode?
GetStringFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
GetXmlFromUrl ( this url, Action requestFilter = null, Action responseFilter = null ) : string
HasStatus ( this webEx, HttpStatusCode statusCode ) : bool
HeadFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
IsAny300 ( this ex ) : bool
IsAny400 ( this ex ) : bool
IsAny500 ( this ex ) : bool
IsBadRequest ( this ex ) : bool
IsForbidden ( this ex ) : bool
IsInternalServerError ( this ex ) : bool
IsNotFound ( this ex ) : bool
IsUnauthorized ( this ex ) : bool
OptionsFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
PostBytesToUrl ( this url, byte requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : byte[]
PostFileToUrl ( this url, FileInfo uploadFileInfo, string uploadFileMimeType, string accept = null, Action requestFilter = null ) : WebResponse
PostJsonToUrl ( this url, object data, Action requestFilter = null, Action responseFilter = null ) : string
PostJsonToUrl ( this url, string json, Action requestFilter = null, Action responseFilter = null ) : string
PostStringToUrl ( this url, string requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
PostToUrl ( this url, object formData = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
PostToUrl ( this url, string formData = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
PostXmlToUrl ( this url, object data, Action requestFilter = null, Action responseFilter = null ) : string
PostXmlToUrl ( this url, string xml, Action requestFilter = null, Action responseFilter = null ) : string
PutBytesToUrl ( this url, byte requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : byte[]
PutFileToUrl ( this url, FileInfo uploadFileInfo, string uploadFileMimeType, string accept = null, Action requestFilter = null ) : WebResponse
PutJsonToUrl ( this url, object data, Action requestFilter = null, Action responseFilter = null ) : string
PutJsonToUrl ( this url, string json, Action requestFilter = null, Action responseFilter = null ) : string
PutStringToUrl ( this url, string requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
PutToUrl ( this url, object formData = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
PutToUrl ( this url, string formData = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
PutXmlToUrl ( this url, object data, Action requestFilter = null, Action responseFilter = null ) : string
PutXmlToUrl ( this url, string xml, Action requestFilter = null, Action responseFilter = null ) : string
ReadLines ( this webRes ) : IEnumerable
ReadToEnd ( this webRes ) : string
SendBytesToUrl ( this url, string method = null, byte requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : byte[]
SendStringToUrl ( this url, string method = null, string requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
SetQueryParam ( this url, string key, string val ) : string
ToFormUrlEncoded ( this queryParams ) : string
UploadFile ( this webRequest, FileInfo uploadFileInfo, string uploadFileMimeType ) : WebResponse
UploadFile ( this webRequest, Stream fileStream, string fileName ) : void
UploadFile ( this webRequest, Stream fileStream, string fileName, string mimeType, string accept = null, Action requestFilter = null, string method = "POST" ) : void

Method Details

AddHashParam() public static méthode

public static AddHashParam ( this url, string key, object val ) : string
url this
key string
val object
Résultat string

AddHashParam() public static méthode

public static AddHashParam ( this url, string key, string val ) : string
url this
key string
val string
Résultat string

AddQueryParam() public static méthode

public static AddQueryParam ( this url, object key, string val, bool encode = true ) : string
url this
key object
val string
encode bool
Résultat string

AddQueryParam() public static méthode

public static AddQueryParam ( this url, string key, object val, bool encode = true ) : string
url this
key string
val object
encode bool
Résultat string

AddQueryParam() public static méthode

public static AddQueryParam ( this url, string key, string val, bool encode = true ) : string
url this
key string
val string
encode bool
Résultat string

DeleteFromUrl() public static méthode

public static DeleteFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
accept string
requestFilter Action
responseFilter Action
Résultat string

GetBytesFromUrl() public static méthode

public static GetBytesFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : byte[]
url this
accept string
requestFilter Action
responseFilter Action
Résultat byte[]

GetErrorResponse() public static méthode

public static GetErrorResponse ( this url ) : HttpWebResponse
url this
Résultat System.Net.HttpWebResponse

GetJsonFromUrl() public static méthode

public static GetJsonFromUrl ( this url, Action requestFilter = null, Action responseFilter = null ) : string
url this
requestFilter Action
responseFilter Action
Résultat string

GetResponseBody() public static méthode

public static GetResponseBody ( this ex ) : string
ex this
Résultat string

GetResponseStatus() public static méthode

public static GetResponseStatus ( this url ) : HttpStatusCode?
url this
Résultat HttpStatusCode?

GetStatus() public static méthode

public static GetStatus ( this ex ) : HttpStatusCode?
ex this
Résultat HttpStatusCode?

GetStringFromUrl() public static méthode

public static GetStringFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
accept string
requestFilter Action
responseFilter Action
Résultat string

GetXmlFromUrl() public static méthode

public static GetXmlFromUrl ( this url, Action requestFilter = null, Action responseFilter = null ) : string
url this
requestFilter Action
responseFilter Action
Résultat string

HasStatus() public static méthode

public static HasStatus ( this webEx, HttpStatusCode statusCode ) : bool
webEx this
statusCode HttpStatusCode
Résultat bool

HeadFromUrl() public static méthode

public static HeadFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
accept string
requestFilter Action
responseFilter Action
Résultat string

IsAny300() public static méthode

public static IsAny300 ( this ex ) : bool
ex this
Résultat bool

IsAny400() public static méthode

public static IsAny400 ( this ex ) : bool
ex this
Résultat bool

IsAny500() public static méthode

public static IsAny500 ( this ex ) : bool
ex this
Résultat bool

IsBadRequest() public static méthode

public static IsBadRequest ( this ex ) : bool
ex this
Résultat bool

IsForbidden() public static méthode

public static IsForbidden ( this ex ) : bool
ex this
Résultat bool

IsInternalServerError() public static méthode

public static IsInternalServerError ( this ex ) : bool
ex this
Résultat bool

IsNotFound() public static méthode

public static IsNotFound ( this ex ) : bool
ex this
Résultat bool

IsUnauthorized() public static méthode

public static IsUnauthorized ( this ex ) : bool
ex this
Résultat bool

OptionsFromUrl() public static méthode

public static OptionsFromUrl ( this url, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
accept string
requestFilter Action
responseFilter Action
Résultat string

PostBytesToUrl() public static méthode

public static PostBytesToUrl ( this url, byte requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : byte[]
url this
requestBody byte
contentType string
accept string
requestFilter Action
responseFilter Action
Résultat byte[]

PostFileToUrl() public static méthode

public static PostFileToUrl ( this url, FileInfo uploadFileInfo, string uploadFileMimeType, string accept = null, Action requestFilter = null ) : WebResponse
url this
uploadFileInfo System.IO.FileInfo
uploadFileMimeType string
accept string
requestFilter Action
Résultat System.Net.WebResponse

PostJsonToUrl() public static méthode

public static PostJsonToUrl ( this url, object data, Action requestFilter = null, Action responseFilter = null ) : string
url this
data object
requestFilter Action
responseFilter Action
Résultat string

PostJsonToUrl() public static méthode

public static PostJsonToUrl ( this url, string json, Action requestFilter = null, Action responseFilter = null ) : string
url this
json string
requestFilter Action
responseFilter Action
Résultat string

PostStringToUrl() public static méthode

public static PostStringToUrl ( this url, string requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
requestBody string
contentType string
accept string
requestFilter Action
responseFilter Action
Résultat string

PostToUrl() public static méthode

public static PostToUrl ( this url, object formData = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
formData object
accept string
requestFilter Action
responseFilter Action
Résultat string

PostToUrl() public static méthode

public static PostToUrl ( this url, string formData = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
formData string
accept string
requestFilter Action
responseFilter Action
Résultat string

PostXmlToUrl() public static méthode

public static PostXmlToUrl ( this url, object data, Action requestFilter = null, Action responseFilter = null ) : string
url this
data object
requestFilter Action
responseFilter Action
Résultat string

PostXmlToUrl() public static méthode

public static PostXmlToUrl ( this url, string xml, Action requestFilter = null, Action responseFilter = null ) : string
url this
xml string
requestFilter Action
responseFilter Action
Résultat string

PutBytesToUrl() public static méthode

public static PutBytesToUrl ( this url, byte requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : byte[]
url this
requestBody byte
contentType string
accept string
requestFilter Action
responseFilter Action
Résultat byte[]

PutFileToUrl() public static méthode

public static PutFileToUrl ( this url, FileInfo uploadFileInfo, string uploadFileMimeType, string accept = null, Action requestFilter = null ) : WebResponse
url this
uploadFileInfo System.IO.FileInfo
uploadFileMimeType string
accept string
requestFilter Action
Résultat System.Net.WebResponse

PutJsonToUrl() public static méthode

public static PutJsonToUrl ( this url, object data, Action requestFilter = null, Action responseFilter = null ) : string
url this
data object
requestFilter Action
responseFilter Action
Résultat string

PutJsonToUrl() public static méthode

public static PutJsonToUrl ( this url, string json, Action requestFilter = null, Action responseFilter = null ) : string
url this
json string
requestFilter Action
responseFilter Action
Résultat string

PutStringToUrl() public static méthode

public static PutStringToUrl ( this url, string requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
requestBody string
contentType string
accept string
requestFilter Action
responseFilter Action
Résultat string

PutToUrl() public static méthode

public static PutToUrl ( this url, object formData = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
formData object
accept string
requestFilter Action
responseFilter Action
Résultat string

PutToUrl() public static méthode

public static PutToUrl ( this url, string formData = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
formData string
accept string
requestFilter Action
responseFilter Action
Résultat string

PutXmlToUrl() public static méthode

public static PutXmlToUrl ( this url, object data, Action requestFilter = null, Action responseFilter = null ) : string
url this
data object
requestFilter Action
responseFilter Action
Résultat string

PutXmlToUrl() public static méthode

public static PutXmlToUrl ( this url, string xml, Action requestFilter = null, Action responseFilter = null ) : string
url this
xml string
requestFilter Action
responseFilter Action
Résultat string

ReadLines() public static méthode

public static ReadLines ( this webRes ) : IEnumerable
webRes this
Résultat IEnumerable

ReadToEnd() public static méthode

public static ReadToEnd ( this webRes ) : string
webRes this
Résultat string

SendBytesToUrl() public static méthode

public static SendBytesToUrl ( this url, string method = null, byte requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : byte[]
url this
method string
requestBody byte
contentType string
accept string
requestFilter Action
responseFilter Action
Résultat byte[]

SendStringToUrl() public static méthode

public static SendStringToUrl ( this url, string method = null, string requestBody = null, string contentType = null, string accept = "*/*", Action requestFilter = null, Action responseFilter = null ) : string
url this
method string
requestBody string
contentType string
accept string
requestFilter Action
responseFilter Action
Résultat string

SetQueryParam() public static méthode

public static SetQueryParam ( this url, string key, string val ) : string
url this
key string
val string
Résultat string

ToFormUrlEncoded() public static méthode

public static ToFormUrlEncoded ( this queryParams ) : string
queryParams this
Résultat string

UploadFile() public static méthode

public static UploadFile ( this webRequest, FileInfo uploadFileInfo, string uploadFileMimeType ) : WebResponse
webRequest this
uploadFileInfo System.IO.FileInfo
uploadFileMimeType string
Résultat System.Net.WebResponse

UploadFile() public static méthode

public static UploadFile ( this webRequest, Stream fileStream, string fileName ) : void
webRequest this
fileStream Stream
fileName string
Résultat void

UploadFile() public static méthode

public static UploadFile ( this webRequest, Stream fileStream, string fileName, string mimeType, string accept = null, Action requestFilter = null, string method = "POST" ) : void
webRequest this
fileStream Stream
fileName string
mimeType string
accept string
requestFilter Action
method string
Résultat void