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


C# ScriptCoreLib.CompleteRequest方法代码示例

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


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

示例1: Handler

        public void Handler(ScriptCoreLib.Ultra.WebService.WebServiceHandler h)
        {
            Console.WriteLine("enter Handler");

            if (h.IsDefaultPath)
            {
                //h.Context.Response.Redirect("/redirect" + DateTime.Now.Millisecond);
                h.Context.Response.Redirect("/redirect" + DateTime.Now.Second);
                h.CompleteRequest();
            }
            else
            {
                // { UserHostAddress = 127.0.0.1, Path = /redirect168, HttpMethod = GET }

                h.Context.Response.AddHeader("hello", "world");

                h.Context.Response.Write(

                    new XElement("pre",
                        new
                        {
                            h.Context.Request.UserHostAddress,
                            h.Context.Request.Path,
                            h.Context.Request.HttpMethod
                        }.ToString()
                    ).ToString()

                );
                h.CompleteRequest();
            }
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:31,代码来源:ApplicationWebService.cs

示例2: Handler


//.........这里部分代码省略.........
                h.Context.Request.HttpMethod
            }.ToString();


            //ScriptCoreLib.Ultra.WebService.InternalGlobalExtensions

            h.Context.Request.QueryString.AllKeys.WithEachIndex(

                (key, index) =>
                {
                    var QueryString = h.Context.Request.QueryString[key];

                    x.Element("body").Add(
                        //new XElement("pre", new { key, index, QueryString }
                        new XElement("pre", new { key, index, QueryString }.ToString()
                        )
                    );

                }
            );


            // does IE send the Form headers?
            // can we see the non javascript post form values on ubuntu?

            // { key = formtext1, index = 0, Form = hello }
            h.Context.Request.Form.AllKeys.WithEachIndex(
                (key, index) =>
                {
                    var Form = h.Context.Request.Form[key];
                    x.Element("body").Add(
                        //new XElement("pre", new { key, index, QueryString }
                        new XElement("pre", new { key, index, Form }.ToString()
                        )
                    );

                }
            );

            h.Context.Request.Headers.AllKeys.WithEachIndex(
              (key, index) =>
              {
                  var Header = h.Context.Request.Headers[key];
                  x.Element("body").Add(
                      //new XElement("pre", new { key, index, QueryString }
                      new XElement("pre", new { key, index, Header }.ToString()
                      )
                  );

              }
          );

            h.Context.Request.Cookies.AllKeys.WithEachIndex(
             (key, index) =>
             {
                 var Cookie = h.Context.Request.Cookies[key].Value;
                 x.Element("body").Add(
                     //new XElement("pre", new { key, index, QueryString }
                     new XElement("pre", new { key, index, Cookie }.ToString()
                     )
                 );

             }
         );

            // { key = file1, index = 0, ContentLength = 1704 }
            // { key = file1, index = 0, ContentLength = 1704 }
            h.Context.Request.Files.AllKeys.WithEachIndex(
               (key, index) =>
               {
                   var File = h.Context.Request.Files[key];
                   x.Element("body").Add(
                       //new XElement("pre", new { key, index, QueryString }
                       new XElement("pre", new { key, index, File.ContentLength }.ToString()
                       )
                   );

               }
           );


            x.Add(
                new XElement("script",
                    new XAttribute("src", "view-source"),
                    " "
                )
            );


            h.Context.Response.SetCookie(
                new System.Web.HttpCookie("hello", "world")
            );

            // view-source ?

            h.Context.Response.Write(x.ToString());

            h.CompleteRequest();
            return;
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationWebService.cs

示例3: Handler

		// sendng dynamic xml, will not help with caching, will it?
		// yet what if we want to list our assets/ for example for janusVR?

		// can we get jsc light speeding fast via ENC?

		// if we could, we would package the static website as a torrent, and seed it via udp forwarding over 4G.
		// yet for now, bit torrent does not work correctly in this scenario, and diagnostics do not tell whats wrong.
		// if we were to publish a tcp server, then the ssl certifcate does not have the alternative wan ip attached.
		// X:\jsc.svn\core\ScriptCoreLib.Ultra.Library\ScriptCoreLib.Ultra.Library\Extensions\TcpListenerExtensions.cs
		// X:\jsc.svn\examples\javascript\Test\TestPackageForTorrent\TestPackageForTorrent\Application.cs
		// X:\jsc.svn\examples\java\android\forms\InteractivePortForwarding\InteractivePortForwarding\UserControl1.cs

		public void Handler(ScriptCoreLib.Ultra.WebService.WebServiceHandler h)
		{
			// http://crockford.com/javascript/jsmin
			// The CompressorRater is currently limited to JavaScript files of 300000 bytes or less!
			// The file view-source.js could not be saved because it exceeds 2 MB, the maximum allowed size for uploads.
			//Error ENC0280 Modifying 'method' which contains an anonymous type will prevent the debug session from continuing.ServerSideContent X:\jsc.svn\examples\javascript\xml\ServerSideContent\ServerSideContent\Application.cs   97

			// what about async, chrome, android, appengine
			// how does this relate to thread jumping, and service worker?

			if (!h.IsDefaultPath)
				return;

			h.Context.Response.Write(@"<!-- 

hello world! will prerender janusVR scene, as API wont enable all of the features just yet at runtime 

-->
				");

			var x = XElement.Parse(JanusVRExperiment.HTML.Pages.AppSource.Text);

			//x.Element("body").Element("FireBoxRoom").Element("Room").Element("Text").Value = "hello from1 ServerSideContent " + new { Debugger.IsAttached };
			x.Element("body").Element("FireBoxRoom").Element("Room").Element("Text").Value = "hello from1 ServerSideContent ";


			// Additional information: An XObject cannot be used as a value.
			x.Element("body").Element("FireBoxRoom").Element("Assets").Add(
				from img in XElement.Parse(TexturesImagesSource.Text).Element("body").Elements("img")
				let src = img.Attribute("src").Value
				let id = img.Attribute("id").Value
				select new XElement("AssetImage",
					new XAttribute("id", id),
					new XAttribute("src", src)
				)
			);

			// http://www.dgp.toronto.edu/~mccrae/projects/firebox/notes.html#assetsound
			// <AssetSound id="localmap_sound" src="localmap.mp3" />
			x.Element("body").Element("FireBoxRoom").Element("Assets").Add(
				from img in XElement.Parse(AudioSource.Text).Element("body").Elements("audio")
				let src = img.Attribute("src").Value
				let id = img.Attribute("id").Value
				select new XElement("AssetSound",
					new XAttribute("id", id),
					new XAttribute("src", src)
				)
			);

			// interface of XElement?

			h.Context.Response.Write(x.ToString());

			h.CompleteRequest();
			return;
		}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:68,代码来源:Application.cs


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