C# Class ServiceStack.HttpRequestExtensions

Exibir arquivo Open project: ServiceStack/ServiceStack Class Usage Examples

Public Methods

Method Description
CookiesAsDictionary ( this httpReq ) : string>.Dictionary
DidReturn304NotModified ( this httpReq, System.DateTime dateTime, IResponse httpRes ) : bool
GetAbsolutePath ( this httpReq ) : string
GetAbsoluteUrl ( this httpReq, string url ) : string
GetApplicationUrl ( this httpReq ) : string
GetAttributes ( IPAddress ipAddress ) : ServiceStack.Host.RequestAttributes
GetAttributes ( this request ) : ServiceStack.Host.RequestAttributes
GetBaseUrl ( this request ) : string
GetDirectoryPath ( this request ) : string
GetFlattenedRequestParams ( this request ) : string>.Dictionary

Duplicate params have their values joined together in a comma-delimited string

GetFormatModifier ( this httpReq ) : string
GetHttpMethodOverride ( this httpReq ) : string
GetItemOrCookie ( this httpReq, string name ) : string

Gets string value from Items[name] then Cookies[name] if exists. Useful when *first* setting the users response cookie in the request filter. To access the value for this initial request you need to set it in Items[].

GetJsonpCallback ( this httpReq ) : string
GetLastPathInfo ( this request ) : string
GetLeftAuthority ( this uri ) : string
GetOperationName ( this request ) : string
GetOperationNameFromLastPathInfo ( string lastPathInfo ) : string
GetOperationType ( this req ) : Type
GetParam ( this httpReq, string name ) : string

Gets request paramater string value by looking in the following order: - QueryString[name] - FormData[name] - Cookies[name] - Items[name]

GetParentAbsolutePath ( this httpReq ) : string
GetParentBaseUrl ( this request ) : string
GetParentPathUrl ( this httpReq ) : string
GetPathAndQuery ( this request ) : string
GetPathInfo ( string fullPath, string mode, string appPath ) : string
GetPathInfo ( this request ) : string
GetPathUrl ( this httpReq ) : string
GetPhysicalPath ( this httpReq ) : string
GetQueryStringContentType ( this httpReq ) : string
GetRequestParams ( this request ) : string>.Dictionary

Duplicate Params are given a unique key by appending a #1 suffix

GetResponseContentType ( this httpReq ) : string
GetRoute ( this req ) : RestPath
GetSoapMessage ( this httpReq ) : System.ServiceModel.Channels.Message
GetTemplate ( this httpReq ) : string
GetUrlHostName ( this httpReq ) : string
GetView ( this httpReq ) : string
GetVirtualDirectory ( this httpReq ) : IVirtualDirectory
GetVirtualFile ( this httpReq ) : IVirtualFile
GetVirtualNode ( this httpReq ) : IVirtualNode
HasAnyOfContentTypes ( this request ) : bool
HasNotModifiedSince ( this httpReq, System.DateTime dateTime ) : bool
InferBaseUrl ( this absoluteUri, string fromPathInfo = null ) : string
IsContentType ( this request, string contentType ) : bool
IsInLocalSubnet ( this ipAddress ) : bool
IsMultiRequest ( this req ) : bool
NormalizeScheme ( this url, bool useHttps ) : string
ResolveAbsoluteUrl ( this httpReq, string url ) : string
ResolveItem ( this httpReq, string itemKey, object>.Func resolveFn ) : object

Use this to treat Request.Items[] as a cache by returning pre-computed items to save calculating them multiple times.

ResolvePathInfoFromMappedPath ( string fullPath, string mappedPathRoot ) : string
SanitizedVirtualPath ( this virtualPath ) : string
SetAutoBatchCompletedHeader ( this req, int completed ) : void
SetOperationName ( this httpReq, string operationName ) : void
SetRoute ( this req, RestPath route ) : void
SetTemplate ( this httpReq, string templateName ) : void
SetView ( this httpReq, string viewName ) : void
ToErrorCode ( this ex ) : string
ToHttpContextBase ( this aspnetHttpReq ) : System.Web.HttpContextBase
ToRequest ( this httpCtx, string operationName = null ) : IHttpRequest
ToRequestAttributes ( string attrNames ) : ServiceStack.Host.RequestAttributes
ToResponse ( this httpCtx ) : IHttpResponse
ToStatusCode ( this ex ) : int
ToWebServiceException ( this error ) : ServiceStack.WebServiceException
UseHttps ( this httpReq ) : bool

Private Methods

Method Description
GetLastPathInfoFromRawUrl ( string rawUrl ) : string
HttpRequestExtensions ( ) : System

Method Details

CookiesAsDictionary() public static method

public static CookiesAsDictionary ( this httpReq ) : string>.Dictionary
httpReq this
return string>.Dictionary

DidReturn304NotModified() public static method

public static DidReturn304NotModified ( this httpReq, System.DateTime dateTime, IResponse httpRes ) : bool
httpReq this
dateTime System.DateTime
httpRes IResponse
return bool

GetAbsolutePath() public static method

public static GetAbsolutePath ( this httpReq ) : string
httpReq this
return string

GetAbsoluteUrl() public static method

public static GetAbsoluteUrl ( this httpReq, string url ) : string
httpReq this
url string
return string

GetApplicationUrl() public static method

public static GetApplicationUrl ( this httpReq ) : string
httpReq this
return string

GetAttributes() public static method

public static GetAttributes ( IPAddress ipAddress ) : ServiceStack.Host.RequestAttributes
ipAddress System.Net.IPAddress
return ServiceStack.Host.RequestAttributes

GetAttributes() public static method

public static GetAttributes ( this request ) : ServiceStack.Host.RequestAttributes
request this
return ServiceStack.Host.RequestAttributes

GetBaseUrl() public static method

public static GetBaseUrl ( this request ) : string
request this
return string

GetDirectoryPath() public static method

public static GetDirectoryPath ( this request ) : string
request this
return string

GetFlattenedRequestParams() public static method

Duplicate params have their values joined together in a comma-delimited string
public static GetFlattenedRequestParams ( this request ) : string>.Dictionary
request this
return string>.Dictionary

GetFormatModifier() public static method

public static GetFormatModifier ( this httpReq ) : string
httpReq this
return string

GetHttpMethodOverride() public static method

public static GetHttpMethodOverride ( this httpReq ) : string
httpReq this
return string

GetItemOrCookie() public static method

Gets string value from Items[name] then Cookies[name] if exists. Useful when *first* setting the users response cookie in the request filter. To access the value for this initial request you need to set it in Items[].
public static GetItemOrCookie ( this httpReq, string name ) : string
httpReq this
name string
return string

GetJsonpCallback() public static method

public static GetJsonpCallback ( this httpReq ) : string
httpReq this
return string

GetLastPathInfo() public static method

public static GetLastPathInfo ( this request ) : string
request this
return string

GetLeftAuthority() public static method

public static GetLeftAuthority ( this uri ) : string
uri this
return string

GetOperationName() public static method

public static GetOperationName ( this request ) : string
request this
return string

GetOperationNameFromLastPathInfo() public static method

public static GetOperationNameFromLastPathInfo ( string lastPathInfo ) : string
lastPathInfo string
return string

GetOperationType() public static method

public static GetOperationType ( this req ) : Type
req this
return System.Type

GetParam() public static method

Gets request paramater string value by looking in the following order: - QueryString[name] - FormData[name] - Cookies[name] - Items[name]
public static GetParam ( this httpReq, string name ) : string
httpReq this
name string
return string

GetParentAbsolutePath() public static method

public static GetParentAbsolutePath ( this httpReq ) : string
httpReq this
return string

GetParentBaseUrl() public static method

public static GetParentBaseUrl ( this request ) : string
request this
return string

GetParentPathUrl() public static method

public static GetParentPathUrl ( this httpReq ) : string
httpReq this
return string

GetPathAndQuery() public static method

public static GetPathAndQuery ( this request ) : string
request this
return string

GetPathInfo() public static method

public static GetPathInfo ( string fullPath, string mode, string appPath ) : string
fullPath string
mode string
appPath string
return string

GetPathInfo() public static method

public static GetPathInfo ( this request ) : string
request this
return string

GetPathUrl() public static method

public static GetPathUrl ( this httpReq ) : string
httpReq this
return string

GetPhysicalPath() public static method

public static GetPhysicalPath ( this httpReq ) : string
httpReq this
return string

GetQueryStringContentType() public static method

public static GetQueryStringContentType ( this httpReq ) : string
httpReq this
return string

GetRequestParams() public static method

Duplicate Params are given a unique key by appending a #1 suffix
public static GetRequestParams ( this request ) : string>.Dictionary
request this
return string>.Dictionary

GetResponseContentType() public static method

public static GetResponseContentType ( this httpReq ) : string
httpReq this
return string

GetRoute() public static method

public static GetRoute ( this req ) : RestPath
req this
return ServiceStack.Host.RestPath

GetSoapMessage() public static method

public static GetSoapMessage ( this httpReq ) : System.ServiceModel.Channels.Message
httpReq this
return System.ServiceModel.Channels.Message

GetTemplate() public static method

public static GetTemplate ( this httpReq ) : string
httpReq this
return string

GetUrlHostName() public static method

public static GetUrlHostName ( this httpReq ) : string
httpReq this
return string

GetView() public static method

public static GetView ( this httpReq ) : string
httpReq this
return string

GetVirtualDirectory() public static method

public static GetVirtualDirectory ( this httpReq ) : IVirtualDirectory
httpReq this
return IVirtualDirectory

GetVirtualFile() public static method

public static GetVirtualFile ( this httpReq ) : IVirtualFile
httpReq this
return IVirtualFile

GetVirtualNode() public static method

public static GetVirtualNode ( this httpReq ) : IVirtualNode
httpReq this
return IVirtualNode

HasAnyOfContentTypes() public static method

public static HasAnyOfContentTypes ( this request ) : bool
request this
return bool

HasNotModifiedSince() public static method

public static HasNotModifiedSince ( this httpReq, System.DateTime dateTime ) : bool
httpReq this
dateTime System.DateTime
return bool

InferBaseUrl() public static method

public static InferBaseUrl ( this absoluteUri, string fromPathInfo = null ) : string
absoluteUri this
fromPathInfo string
return string

IsContentType() public static method

public static IsContentType ( this request, string contentType ) : bool
request this
contentType string
return bool

IsInLocalSubnet() public static method

public static IsInLocalSubnet ( this ipAddress ) : bool
ipAddress this
return bool

IsMultiRequest() public static method

public static IsMultiRequest ( this req ) : bool
req this
return bool

NormalizeScheme() public static method

public static NormalizeScheme ( this url, bool useHttps ) : string
url this
useHttps bool
return string

ResolveAbsoluteUrl() public static method

public static ResolveAbsoluteUrl ( this httpReq, string url ) : string
httpReq this
url string
return string

ResolveItem() public static method

Use this to treat Request.Items[] as a cache by returning pre-computed items to save calculating them multiple times.
public static ResolveItem ( this httpReq, string itemKey, object>.Func resolveFn ) : object
httpReq this
itemKey string
resolveFn object>.Func
return object

ResolvePathInfoFromMappedPath() public static method

public static ResolvePathInfoFromMappedPath ( string fullPath, string mappedPathRoot ) : string
fullPath string
mappedPathRoot string
return string

SanitizedVirtualPath() public static method

public static SanitizedVirtualPath ( this virtualPath ) : string
virtualPath this
return string

SetAutoBatchCompletedHeader() public static method

public static SetAutoBatchCompletedHeader ( this req, int completed ) : void
req this
completed int
return void

SetOperationName() public static method

public static SetOperationName ( this httpReq, string operationName ) : void
httpReq this
operationName string
return void

SetRoute() public static method

public static SetRoute ( this req, RestPath route ) : void
req this
route ServiceStack.Host.RestPath
return void

SetTemplate() public static method

public static SetTemplate ( this httpReq, string templateName ) : void
httpReq this
templateName string
return void

SetView() public static method

public static SetView ( this httpReq, string viewName ) : void
httpReq this
viewName string
return void

ToErrorCode() public static method

public static ToErrorCode ( this ex ) : string
ex this
return string

ToHttpContextBase() public static method

public static ToHttpContextBase ( this aspnetHttpReq ) : System.Web.HttpContextBase
aspnetHttpReq this
return System.Web.HttpContextBase

ToRequest() public static method

public static ToRequest ( this httpCtx, string operationName = null ) : IHttpRequest
httpCtx this
operationName string
return IHttpRequest

ToRequestAttributes() public static method

public static ToRequestAttributes ( string attrNames ) : ServiceStack.Host.RequestAttributes
attrNames string
return ServiceStack.Host.RequestAttributes

ToResponse() public static method

public static ToResponse ( this httpCtx ) : IHttpResponse
httpCtx this
return IHttpResponse

ToStatusCode() public static method

public static ToStatusCode ( this ex ) : int
ex this
return int

ToWebServiceException() public static method

public static ToWebServiceException ( this error ) : ServiceStack.WebServiceException
error this
return ServiceStack.WebServiceException

UseHttps() public static method

public static UseHttps ( this httpReq ) : bool
httpReq this
return bool