本文整理汇总了C#中Request.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Request.GetType方法的具体用法?C# Request.GetType怎么用?C# Request.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request.GetType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResponseTypeFor
public Type GetResponseTypeFor(Request request)
{
if (request == null) throw new ArgumentNullException("request");
var requestType = request.GetType();
if (!requestResponseMappings.ContainsKey(requestType))
throw new Exception("No response type found by convention for request type " + requestType);
return requestResponseMappings[requestType];
}
示例2: AfterHandle
protected override void AfterHandle(Request request)
{
base.AfterHandle(request);
requestStopwatch.Stop();
// TODO: make the 100ms limit configurable
if (requestStopwatch.ElapsedMilliseconds > 100)
{
performanceLogger.Warn(string.Format("Performance warning: {0}ms for {1}", requestStopwatch.ElapsedMilliseconds, request.GetType().Name));
}
}
示例3: GetRequestHandlerTypeFor
private static Type GetRequestHandlerTypeFor(Request request)
{
return typeof(IRequestHandler<>).MakeGenericType(request.GetType());
}
示例4: GetResponseTypeFor
public Type GetResponseTypeFor(Request request)
{
if (request == null) throw new ArgumentNullException("request");
return requestResponseMappings[request.GetType()];
}
示例5: GetRequestInfo
private static IEnumerable<string> GetRequestInfo(Request request) =>
request.GetType().GetProperties().Select(p => $"<div>{p.Name}: {p.GetValue(request)}</div>");
示例6: StoreInCache
public virtual void StoreInCache(Request request, Response response)
{
var config = configuration.GetConfigurationFor(request.GetType());
StoreInCache(request, response, config.Expiration, config.Region ?? DefaultRegionName);
}
示例7: GetCachedResponseFor
public virtual Response GetCachedResponseFor(Request request)
{
return GetCachedResponseFor(request, configuration.GetRegionNameFor(request.GetType()) ?? DefaultRegionName);
}
示例8: BuildKey
/// <summary>
/// Gets the key.
/// </summary>
/// <param name="request">The request.</param>
/// <returns></returns>
protected virtual string BuildKey(Request request)
{
return string.Concat(request.GetType().Name, ":", request.GetHashCode());
}
示例9: listenerCallback
//.........这里部分代码省略.........
}
if (postTab[i].Length > 0)
{
req.FormData.Add(postName, HttpUtility.UrlDecode(postTab[i]).Trim());
}
}
}
}
FeintSDK.RequestMethod actualMethod = FeintSDK.RequestMethod.POST;
switch (request.HttpMethod)
{
case "GET":
actualMethod = FeintSDK.RequestMethod.GET;
break;
case "POST":
actualMethod = FeintSDK.RequestMethod.POST;
break;
case "PUT":
actualMethod = FeintSDK.RequestMethod.PUT;
break;
case "DELETE":
actualMethod = FeintSDK.RequestMethod.DELETE;
break;
}
if (!req.Url.EndsWith("/"))
req.Url += "/";
for (int i = 0; i < FeintSDK.Settings.Urls.Count; i++)
{
var match = Regex.Match(req.Url.ToString(), FeintSDK.Settings.Urls[i].UrlMatch);
if (match.Success && (FeintSDK.Settings.Urls[i].Method == FeintSDK.RequestMethod.ALL || actualMethod == FeintSDK.Settings.Urls[i].Method))
{
setNonPublicSetProperty(req, req.GetType(), "Variables", match.Groups);
setSesion(request, response, req);
MethodInfo mi = FeintSDK.Settings.Urls[i].View.GetMethodInfo();
FeintSDK.AOPAttribute[] aops = (FeintSDK.AOPAttribute[])mi.GetCustomAttributes(typeof(FeintSDK.AOPAttribute), true);
res = null;
foreach (var aop in aops)
{
res = aop.PreRequest(req);
}
if (res == null)
{
res = FeintSDK.Settings.Urls[i].View(req);
if (res.MimeType != null)
{
response.Headers.Add("Content-Type", res.MimeType + "; charset=utf-8");
}
}
var redirect = res.GetType().GetField("redirectUrl",
BindingFlags.NonPublic |
BindingFlags.Instance);
foreach (var aop in aops)
{
aop.PostRequest(req);
}
String url = (String)redirect.GetValue(res);
if (url != null)
{
//response.SeeOtherRedirect(url);
response.Redirect(url);
response.Close();
return;
示例10: RequestTypeAllreadyUsedWithoutKey
public bool RequestTypeAllreadyUsedWithoutKey(Request request)
{
return requestTypesUsed.Any(type => type == request.GetType());
}