当前位置: 首页>>代码示例>>C#>>正文


C# DreamContext.Relay方法代码示例

本文整理汇总了C#中DreamContext.Relay方法的典型用法代码示例。如果您正苦于以下问题:C# DreamContext.Relay方法的具体用法?C# DreamContext.Relay怎么用?C# DreamContext.Relay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DreamContext的用法示例。


在下文中一共展示了DreamContext.Relay方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProxyToService

        public Yield ProxyToService(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
            PermissionsBL.IsUserAllowed(DekiContext.Current.User, Permissions.ADMIN);

            //Private feature requires api-key
            var identifier = context.GetParam("id");
            ServiceRepository.IServiceInfo serviceInfo = null;
            if(identifier.StartsWith("=")) {
                serviceInfo = DekiContext.Current.Instance.RunningServices[XUri.Decode(identifier.Substring(1))];
            } else {
                uint serviceId;
                if(uint.TryParse(identifier, out serviceId)) {
                    serviceInfo = DekiContext.Current.Instance.RunningServices[serviceId];
                } else {
                    throw new DreamBadRequestException(string.Format("Invalid id '{0}'", identifier));
                }
            }
            if(serviceInfo == null) {
                response.Return(DreamMessage.NotFound(string.Format(DekiResources.SERVICE_NOT_FOUND, identifier)));
                yield break;
            }
            var proxyUri = serviceInfo.ServiceUri.At(context.GetSuffixes(UriPathFormat.Original).Skip(1).ToArray());

            yield return context.Relay(Plug.New(proxyUri), request, response);
        }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:24,代码来源:DekiWiki-Services.cs

示例2: GetHttp

 public Yield GetHttp(DreamContext context, DreamMessage request, Result<DreamMessage> response)
 {
     yield return context.Relay(_redirect.At(context.GetSuffixes(UriPathFormat.Original)), request, response);
 }
开发者ID:sdether,项目名称:DReAM,代码行数:4,代码来源:RedirectService.cs

示例3: GetImage

 public Yield GetImage(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     string image = context.GetParam("name");
     if(Path.GetExtension(image) != ".png") {
         response.Return(DreamMessage.NotFound("image not found"));
     } else {
         yield return context.Relay(Storage.At(image), request, response);
     }
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:8,代码来源:MathService.cs

示例4: GetImage

 public Yield GetImage(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     yield return context.Relay(Storage.At(context.GetParam("name")), request, response);
 }
开发者ID:heran,项目名称:DekiWiki,代码行数:3,代码来源:GraphvizService.cs

示例5: GetFiles

 public Yield GetFiles(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     if(_resourcesUri != null) {
         yield return context.Relay(Plug.New(_resourcesUri).AtPath(string.Join("/", context.GetSuffixes(UriPathFormat.Original))), request, response);
     } else {
         response.Return(GetFile(context));
     }
     yield break;
 }
开发者ID:heran,项目名称:DekiWiki,代码行数:8,代码来源:DekiScriptHostService.cs

示例6: GetErrorXsl

 public Yield GetErrorXsl(DreamContext context, DreamMessage request, Result<DreamMessage> response)
 {
     string resource = context.GetParam("resource");
     Plug plug = Plug.New(string.Format("resource://mindtouch.core/MindTouch.Dream.resources.host.{0}", resource)).With(DreamOutParam.TYPE, MimeType.FromFileExtension(resource).FullType);
     yield return context.Relay(plug, request, response);
 }
开发者ID:nataren,项目名称:DReAM,代码行数:6,代码来源:DreamHostService.cs

示例7: home

 public Yield home(DreamContext context) {
     yield return context.Relay(_fs.At("metl.html"), "GET:", null, null);
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:3,代码来源:ServiceRoot.cs

示例8: PostUnsubscribeEvents

 public Yield PostUnsubscribeEvents(DreamContext context, DreamMessage request, Result<DreamMessage> response)
 {
     yield return context.Relay(_events.At("unsubscribe"), request, response);
 }
开发者ID:sdether,项目名称:DReAM,代码行数:4,代码来源:directoryservice.cs

示例9: FeatureGetAuthenticate

 public Yield FeatureGetAuthenticate(DreamContext context, DreamMessage request, Result<DreamMessage> response) {
     string user = Authenticate(context, request);
     
     string password;
     HttpUtil.GetAuthentication(context.Uri.ToUri(), request.Headers, out user, out password);
     yield return context.Relay(Self.At("users", XUri.Encode(user)).WithCredentials(user, password), request, response);
 }
开发者ID:heran,项目名称:DekiWiki,代码行数:7,代码来源:AuthenticationService.cs


注:本文中的DreamContext.Relay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。