RequestExtensions
Assembly: ServiceStack.dll
View Source
public static class RequestExtensions
Methods
ReloadSession(IRequest)
View Source
public static AuthUserSession ReloadSession(this IRequest request)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetCompressionType(IRequest)
View Source
public static string GetCompressionType(this IRequest request)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetCompressor(IRequest)
View Source
public static IStreamCompressor GetCompressor(this IRequest request)
Returns
ServiceStack.Caching.IStreamCompressor
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetContentEncoding(IRequest)
View Source
public static string GetContentEncoding(this IRequest request)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetInputStream(IRequest, Stream)
View Source
public static Stream GetInputStream(this IRequest req, Stream stream)
Returns
System.IO.Stream
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.IO.Stream | stream |
GetHeader(IRequest, String)
View Source
public static string GetHeader(this IRequest request, string headerName)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.String | headerName |
GetParamInRequestHeader(IRequest, String)
View Source
public static string GetParamInRequestHeader(this IRequest request, string name)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.String | name |
ToOptimizedResult(IRequest, Object)
Returns the optimized result for the IRequest. Does not use or store results in any cache.
View Source
[Obsolete("Use ToOptimizedResultAsync")]
public static object ToOptimizedResult(this IRequest request, object dto)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.Object | dto |
ToOptimizedResultAsync(IRequest, Object)
Returns the optimized result for the IRequest. Does not use or store results in any cache.
View Source
public static async Task<object> ToOptimizedResultAsync(this IRequest request, object dto)
Returns
System.Threading.Tasks.Task<System.Object>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.Object | dto |
ToOptimizedResultUsingCache<T>(IRequest, ICacheClient, String, Func<T>)
Returning the most optimized result based on the MimeType and CompressionType from the IRequest.
View Source
public static object ToOptimizedResultUsingCache<T>(this IRequest req, ICacheClient cacheClient, string cacheKey, Func<T> factoryFn)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Caching.ICacheClient | cacheClient |
System.String | cacheKey |
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
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
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Caching.ICacheClientAsync | cacheClient |
System.String | cacheKey |
System.Func<<T>> | factoryFn |
System.Threading.CancellationToken | token |
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
public static object ToOptimizedResultUsingCache<T>(this IRequest req, ICacheClient cacheClient, string cacheKey, TimeSpan? expireCacheIn, Func<T> factoryFn)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Caching.ICacheClient | cacheClient |
System.String | cacheKey |
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
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
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
ServiceStack.Caching.ICacheClientAsync | cacheClient |
System.String | cacheKey |
System.Nullable<System.TimeSpan> | expireCacheIn |
System.Func<<T>> | factoryFn |
System.Threading.CancellationToken | token |
Type Parameters
T
SetItem(IRequest, String, Object)
Store an entry in the IHttpRequest.Items Dictionary
View Source
public static void SetItem(this IRequest httpReq, string key, object value)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
System.String | key |
System.Object | value |
GetItem(IRequest, String)
Get an entry from the IHttpRequest.Items Dictionary
View Source
public static object GetItem(this IRequest httpReq, string key)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
System.String | key |
ToHttpRequestBase(IRequest)
View Source
public static RequestBaseWrapper ToHttpRequestBase(this IRequest httpReq)
Returns
ServiceStack.Host.RequestBaseWrapper
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
SetInProcessRequest(IRequest)
View Source
public static void SetInProcessRequest(this IRequest httpReq)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
IsInProcessRequest(IRequest)
View Source
public static bool IsInProcessRequest(this IRequest httpReq)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
ReleaseIfInProcessRequest(IRequest)
View Source
public static void ReleaseIfInProcessRequest(this IRequest httpReq)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | httpReq |
GetFile(IRequest)
View Source
public static IVirtualFile GetFile(this IRequest request)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetDirectory(IRequest)
View Source
public static IVirtualDirectory GetDirectory(this IRequest request)
Returns
ServiceStack.IO.IVirtualDirectory
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
IsFile(IRequest)
View Source
public static bool IsFile(this IRequest request)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
IsDirectory(IRequest)
View Source
public static bool IsDirectory(this IRequest request)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetVirtualFiles(IRequest)
View Source
public static IVirtualFiles GetVirtualFiles(this IRequest request)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetVirtualFileSources(IRequest)
View Source
public static IVirtualPathProvider GetVirtualFileSources(this IRequest request)
Returns
ServiceStack.IO.IVirtualPathProvider
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetRuntimeConfig<T>(IRequest, String, T)
View Source
public static T GetRuntimeConfig<T>(this IRequest req, string name, T defaultValue)
Returns
<T>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
<T> | defaultValue |
Type Parameters
T
RegisterForDispose(IRequest, IDisposable)
View Source
public static void RegisterForDispose(this IRequest request, IDisposable disposable)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.IDisposable | disposable |
GetSessionFromSourceAsync(IRequest, String, Func<IAuthRepositoryAsync, IUserAuth, Task>, CancellationToken)
View Source
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
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.String | userAuthId |
System.Func<ServiceStack.Auth.IAuthRepositoryAsync,ServiceStack.Auth.IUserAuth,System.Threading.Tasks.Task> | validator |
System.Threading.CancellationToken | token |
GetTraceId(IRequest)
View Source
public static string GetTraceId(this IRequest req)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetElapsed(IRequest)
View Source
public static TimeSpan GetElapsed(this IRequest req)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
AllowConnection(IRequest, Boolean)
View Source
public static bool AllowConnection(this IRequest req, bool requireSecureConnection)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Boolean | requireSecureConnection |
CompletedAuthentication(IRequest)
View Source
public static void CompletedAuthentication(this IRequest req)
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
GetRequestParams(IRequest)
View Source
public static Dictionary<string, string> GetRequestParams(this IRequest request)
Returns
System.Collections.Generic.Dictionary<System.String,System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetRequestParams(IRequest, HashSet<String>)
Duplicate Params are given a unique key by appending a #1 suffix
View Source
public static Dictionary<string, string> GetRequestParams(this IRequest request, HashSet<string> exclude)
Returns
System.Collections.Generic.Dictionary<System.String,System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.Collections.Generic.HashSet<System.String> | exclude |
GetDtoQueryParams(IRequest)
View Source
public static Dictionary<string, string> GetDtoQueryParams(this IRequest request)
Returns
System.Collections.Generic.Dictionary<System.String,System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
GetDtoQueryParams(IRequest, HashSet<String>)
View Source
public static Dictionary<string, string> GetDtoQueryParams(this IRequest request, HashSet<string> exclude)
Returns
System.Collections.Generic.Dictionary<System.String,System.String>
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | request |
System.Collections.Generic.HashSet<System.String> | exclude |