本文整理汇总了C#中ICommunicationContext.FetchHeaders方法的典型用法代码示例。如果您正苦于以下问题:C# ICommunicationContext.FetchHeaders方法的具体用法?C# ICommunicationContext.FetchHeaders怎么用?C# ICommunicationContext.FetchHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICommunicationContext
的用法示例。
在下文中一共展示了ICommunicationContext.FetchHeaders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequest
public override void ProcessRequest(ICommunicationContext ctx)
{
var postDataListID = GetDataListID(ctx);
if(postDataListID != null)
{
new WebPostRequestHandler().ProcessRequest(ctx);
return;
}
var serviceName = GetServiceName(ctx);
var workspaceID = GetWorkspaceID(ctx);
var requestTO = new WebRequestTO { ServiceName = serviceName, WebServerUrl = ctx.Request.Uri.ToString(), Dev2WebServer = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority) };
var data = GetPostData(ctx);
if(!String.IsNullOrEmpty(data))
{
requestTO.RawRequestPayload = data;
}
var variables = ctx.Request.BoundVariables;
if(variables != null)
{
foreach(string key in variables)
{
requestTO.Variables.Add(key, variables[key]);
}
}
// Execute in its own thread to give proper context ;)
Thread.CurrentPrincipal = ctx.Request.User;
var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders());
ctx.Send(responseWriter);
}
示例2: ProcessRequest
public override void ProcessRequest(ICommunicationContext ctx)
{
var serviceName = GetServiceName(ctx);
var instanceId = GetInstanceID(ctx);
var bookmark = GetBookmark(ctx);
var postDataListID = GetDataListID(ctx);
var workspaceID = GetWorkspaceID(ctx);
var requestTO = new WebRequestTO();
var xml = GetPostData(ctx, postDataListID);
if(!String.IsNullOrEmpty(xml))
{
requestTO.RawRequestPayload = xml;
}
requestTO.ServiceName = serviceName;
requestTO.InstanceID = instanceId;
requestTO.Bookmark = bookmark;
requestTO.WebServerUrl = ctx.Request.Uri.ToString();
requestTO.Dev2WebServer = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority);
// Execute in its own thread to give proper context ;)
Thread.CurrentPrincipal = ctx.Request.User;
var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders(), PublicFormats, ctx.Request.User);
ctx.Send(responseWriter);
}
示例3: ProcessRequest
public override void ProcessRequest(ICommunicationContext ctx)
{
var serviceName = GetServiceName(ctx);
var instanceId = GetInstanceID(ctx);
var bookmark = GetBookmark(ctx);
GetDataListID(ctx);
var workspaceID = GetWorkspaceID(ctx);
var formData = new WebRequestTO();
var xml = GetPostData(ctx);
if(!String.IsNullOrEmpty(xml))
{
formData.RawRequestPayload = xml;
}
formData.ServiceName = serviceName;
formData.InstanceID = instanceId;
formData.Bookmark = bookmark;
formData.WebServerUrl = ctx.Request.Uri.ToString();
formData.Dev2WebServer = String.Format("{0}://{1}", ctx.Request.Uri.Scheme, ctx.Request.Uri.Authority);
if(ExecutingUser == null)
{
throw new Exception("Null Executing User");
}
try
{
// Execute in its own thread to give proper context ;)
var t = new Thread(() =>
{
Thread.CurrentPrincipal = ExecutingUser;
var responseWriter = CreateForm(formData, serviceName, workspaceID, ctx.FetchHeaders(),ctx.Request.User);
ctx.Send(responseWriter);
});
t.Start();
t.Join();
}
catch(Exception e)
{
// ReSharper disable InvokeAsExtensionMethod
Dev2Logger.Log.Error(this, e);
// ReSharper restore InvokeAsExtensionMethod
}
}