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(); } }
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201510/20151023/ubuntuwebapplication // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201510/20151022/httprequest // Z:\jsc.svn\examples\javascript\appengine\test\TestRedirect\ApplicationWebService.cs public void Handler(ScriptCoreLib.Ultra.WebService.WebServiceHandler h) { // enable GetColor if (h.Context.Request.Path.StartsWith("/xml/")) return; if (h.Context.Request.Path == "/view-source") return; if (h.Context.Request.Path == "/jsc") return; //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(HTML.Pages.AppSource.Text); // port rewriter for cassini? // { UserHostAddress = 127.0.0.1 } // appengine now reports. // enter InternalInvokeWebService // {{ UserHostAddress = 192.168.1.196 }} //x.Element("body").Element("FireBoxRoom").Element("Room").Element("Text").Value = "hello from1 ServerSideContent " + new { Debugger.IsAttached }; x.Element("body").Element("pre").Value = new { h.Context.Request.UserHostAddress, h.Context.Request.Path, 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; }
// 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; }