Skip to main content

RequestExtensions

Assembly: ServiceStack.dll
View Source
Declaration
public static class RequestExtensions

Methods

ReloadSession(IRequest)

View Source
Declaration
public static AuthUserSession ReloadSession(this IRequest request)
Returns

ServiceStack.AuthUserSession

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetCompressionType(IRequest)

View Source
Declaration
public static string GetCompressionType(this IRequest request)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetCompressor(IRequest)

View Source
Declaration
public static IStreamCompressor GetCompressor(this IRequest request)
Returns

ServiceStack.Caching.IStreamCompressor

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetContentEncoding(IRequest)

View Source
Declaration
public static string GetContentEncoding(this IRequest request)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetInputStream(IRequest, Stream)

View Source
Declaration
public static Stream GetInputStream(this IRequest req, Stream stream)
Returns

System.IO.Stream

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.IO.Streamstream

GetHeader(IRequest, String)

View Source
Declaration
public static string GetHeader(this IRequest request, string headerName)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.StringheaderName

GetParamInRequestHeader(IRequest, String)

View Source
Declaration
public static string GetParamInRequestHeader(this IRequest request, string name)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.Stringname

ToOptimizedResult(IRequest, Object)

Returns the optimized result for the IRequest. Does not use or store results in any cache.

View Source
Declaration
[Obsolete("Use ToOptimizedResultAsync")]
public static object ToOptimizedResult(this IRequest request, object dto)
Returns

System.Object

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.Objectdto

ToOptimizedResultAsync(IRequest, Object)

Returns the optimized result for the IRequest. Does not use or store results in any cache.

View Source
Declaration
public static async Task<object> ToOptimizedResultAsync(this IRequest request, object dto)
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.Objectdto

ToOptimizedResultUsingCache<T>(IRequest, ICacheClient, String, Func<T>)

Returning the most optimized result based on the MimeType and CompressionType from the IRequest.

View Source
Declaration
public static object ToOptimizedResultUsingCache<T>(this IRequest req, ICacheClient cacheClient, string cacheKey, Func<T> factoryFn)
Returns

System.Object

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Caching.ICacheClientcacheClient
System.StringcacheKey
System.Func<<T>>factoryFn
Type Parameters
  • T

ToOptimizedResultUsingCacheAsync<T>(IRequest, ICacheClientAsync, String, Func<T>, CancellationToken)

Returning the most optimized result based on the MimeType and CompressionType from the IRequest.

View Source
Declaration
public static Task<object> ToOptimizedResultUsingCacheAsync<T>(this IRequest req, ICacheClientAsync cacheClient, string cacheKey, Func<T> factoryFn, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Caching.ICacheClientAsynccacheClient
System.StringcacheKey
System.Func<<T>>factoryFn
System.Threading.CancellationTokentoken
Type Parameters
  • T

ToOptimizedResultUsingCache<T>(IRequest, ICacheClient, String, Nullable<TimeSpan>, Func<T>)

Returning the most optimized result based on the MimeType and CompressionType from the IRequest. <param name="req" /> <param name="cacheClient" /> <param name="cacheKey" /> <param name="expireCacheIn">How long to cache for, null is no expiration</param> <param name="factoryFn" />

View Source
Declaration
public static object ToOptimizedResultUsingCache<T>(this IRequest req, ICacheClient cacheClient, string cacheKey, TimeSpan? expireCacheIn, Func<T> factoryFn)
Returns

System.Object

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Caching.ICacheClientcacheClient
System.StringcacheKey
System.Nullable<System.TimeSpan>expireCacheIn
System.Func<<T>>factoryFn
Type Parameters
  • T

ToOptimizedResultUsingCacheAsync<T>(IRequest, ICacheClientAsync, String, Nullable<TimeSpan>, Func<T>, CancellationToken)

Returning the most optimized result based on the MimeType and CompressionType from the IRequest. <param name="req" /> <param name="cacheClient" /> <param name="cacheKey" /> <param name="expireCacheIn">How long to cache for, null is no expiration</param> <param name="factoryFn" /> <param name="token" />

View Source
Declaration
public static async Task<object> ToOptimizedResultUsingCacheAsync<T>(this IRequest req, ICacheClientAsync cacheClient, string cacheKey, TimeSpan? expireCacheIn, Func<T> factoryFn, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<System.Object>

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Caching.ICacheClientAsynccacheClient
System.StringcacheKey
System.Nullable<System.TimeSpan>expireCacheIn
System.Func<<T>>factoryFn
System.Threading.CancellationTokentoken
Type Parameters
  • T

SetItem(IRequest, String, Object)

Store an entry in the IHttpRequest.Items Dictionary

View Source
Declaration
public static void SetItem(this IRequest httpReq, string key, object value)
Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
System.Stringkey
System.Objectvalue

GetItem(IRequest, String)

Get an entry from the IHttpRequest.Items Dictionary

View Source
Declaration
public static object GetItem(this IRequest httpReq, string key)
Returns

System.Object

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq
System.Stringkey

ToHttpRequestBase(IRequest)

View Source
Declaration
public static RequestBaseWrapper ToHttpRequestBase(this IRequest httpReq)
Returns

ServiceStack.Host.RequestBaseWrapper

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq

SetInProcessRequest(IRequest)

View Source
Declaration
public static void SetInProcessRequest(this IRequest httpReq)
Parameters
TypeName
ServiceStack.Web.IRequesthttpReq

IsInProcessRequest(IRequest)

View Source
Declaration
public static bool IsInProcessRequest(this IRequest httpReq)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequesthttpReq

ReleaseIfInProcessRequest(IRequest)

View Source
Declaration
public static void ReleaseIfInProcessRequest(this IRequest httpReq)
Parameters
TypeName
ServiceStack.Web.IRequesthttpReq

GetFile(IRequest)

View Source
Declaration
public static IVirtualFile GetFile(this IRequest request)
Returns

ServiceStack.IO.IVirtualFile

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetDirectory(IRequest)

View Source
Declaration
public static IVirtualDirectory GetDirectory(this IRequest request)
Returns

ServiceStack.IO.IVirtualDirectory

Parameters
TypeName
ServiceStack.Web.IRequestrequest

IsFile(IRequest)

View Source
Declaration
public static bool IsFile(this IRequest request)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestrequest

IsDirectory(IRequest)

View Source
Declaration
public static bool IsDirectory(this IRequest request)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetVirtualFiles(IRequest)

View Source
Declaration
public static IVirtualFiles GetVirtualFiles(this IRequest request)
Returns

ServiceStack.IO.IVirtualFiles

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetVirtualFileSources(IRequest)

View Source
Declaration
public static IVirtualPathProvider GetVirtualFileSources(this IRequest request)
Returns

ServiceStack.IO.IVirtualPathProvider

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetRuntimeConfig<T>(IRequest, String, T)

View Source
Declaration
public static T GetRuntimeConfig<T>(this IRequest req, string name, T defaultValue)
Returns

<T>

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Stringname
<T>defaultValue
Type Parameters
  • T

RegisterForDispose(IRequest, IDisposable)

View Source
Declaration
public static void RegisterForDispose(this IRequest request, IDisposable disposable)
Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.IDisposabledisposable

GetSessionFromSourceAsync(IRequest, String, Func<IAuthRepositoryAsync, IUserAuth, Task>, CancellationToken)

View Source
Declaration
public static async Task<SessionSourceResult> GetSessionFromSourceAsync(this IRequest request, string userAuthId, Func<IAuthRepositoryAsync, IUserAuth, Task> validator, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<ServiceStack.SessionSourceResult>

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.StringuserAuthId
System.Func<ServiceStack.Auth.IAuthRepositoryAsync,ServiceStack.Auth.IUserAuth,System.Threading.Tasks.Task>validator
System.Threading.CancellationTokentoken

GetTraceId(IRequest)

View Source
Declaration
public static string GetTraceId(this IRequest req)
Returns

System.String

Parameters
TypeName
ServiceStack.Web.IRequestreq

GetElapsed(IRequest)

View Source
Declaration
public static TimeSpan GetElapsed(this IRequest req)
Returns

System.TimeSpan

Parameters
TypeName
ServiceStack.Web.IRequestreq

AllowConnection(IRequest, Boolean)

View Source
Declaration
public static bool AllowConnection(this IRequest req, bool requireSecureConnection)
Returns

System.Boolean

Parameters
TypeName
ServiceStack.Web.IRequestreq
System.BooleanrequireSecureConnection

CompletedAuthentication(IRequest)

View Source
Declaration
public static void CompletedAuthentication(this IRequest req)
Parameters
TypeName
ServiceStack.Web.IRequestreq

GetRequestParams(IRequest)

View Source
Declaration
public static Dictionary<string, string> GetRequestParams(this IRequest request)
Returns

System.Collections.Generic.Dictionary<System.String,System.String>

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetRequestParams(IRequest, HashSet<String>)

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

View Source
Declaration
public static Dictionary<string, string> GetRequestParams(this IRequest request, HashSet<string> exclude)
Returns

System.Collections.Generic.Dictionary<System.String,System.String>

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.Collections.Generic.HashSet<System.String>exclude

GetDtoQueryParams(IRequest)

View Source
Declaration
public static Dictionary<string, string> GetDtoQueryParams(this IRequest request)
Returns

System.Collections.Generic.Dictionary<System.String,System.String>

Parameters
TypeName
ServiceStack.Web.IRequestrequest

GetDtoQueryParams(IRequest, HashSet<String>)

View Source
Declaration
public static Dictionary<string, string> GetDtoQueryParams(this IRequest request, HashSet<string> exclude)
Returns

System.Collections.Generic.Dictionary<System.String,System.String>

Parameters
TypeName
ServiceStack.Web.IRequestrequest
System.Collections.Generic.HashSet<System.String>exclude