public void Handler(WebServiceHandler h) { var f = h.GetFiles().FirstOrDefault(k => k.Name.SkipUntilLastOrEmpty("/") == h.Context.Request.Path.SkipUntilLastOrEmpty("/")); if (f != null) { if (h.Context.Request.Path != "/" + f.Name) { h.Context.Response.Redirect("/" + f.Name); h.CompleteRequest(); return; } } }
//[MethodImplAttributes] public /* will not be part of web service itself */ void Handler(WebServiceHandler h) { Console.WriteLine("enter Handler"); //script: error JSC1000: Java : // BCL needs another method, please define it. // Cannot call type without script attribute : // System.Threading.Monitor for Void Enter(System.Object, Boolean ByRef) used at // ExperimentalCompositeFileStream.ApplicationWebService.Handler at offset 0018. // If the use of this method is intended, an implementation should be provided with the attribute [Script(Implements=typeof(...)] set. You may have mistyped it. //System.InvalidOperationException: Java : // BCL needs another method, please define it. //lock (HandlerSync) { Console.WriteLine("enter Handler lock"); //Error 2 The type arguments for method 'System.Linq.Enumerable.Select<TSource,TResult>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TResult>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. X:\jsc.svn\examples\javascript\android\ExperimentalCompositeFileStream\ExperimentalCompositeFileStream\ApplicationWebService.cs 33 22 ExperimentalCompositeFileStream //enter GetBytes //{ Name = ExperimentalCompositeFileStream.Application.exe.js } //{ Name = ScriptCoreLib.dll.js } //{ Name = Application.htm } //{ Name = assets/ExperimentalCompositeFileStream/App.css } //{ Name = assets/ScriptCoreLib/jsc.ico } //{ Name = assets/ScriptCoreLib/jsc.png } //{ Name = assets/ScriptCoreLib/loading.gif } //{ Name = assets/ScriptCoreLib/Windows Ding.wav } //{ Name = ExperimentalCompositeFileStream.Application.exe.jsgz } //exit GetBytes var e = new Stopwatch(); e.Start(); var c = new XCompositeStream( h.GetFiles().Select(k => { Console.WriteLine(new { k.Name }); return new Func<Stream>( () => { Console.WriteLine(new { k.Name }); return (Stream)File.OpenRead(k.Name); } ); } ) ); var count = 0; var buffer = new byte[1024 * 40]; foreach (var y in c.GetBytes(buffer)) { //if (count % (1024 * 40) == 0) //{ // //I/System.Console(12919): Caused by: java.lang.NullPointerException // //I/System.Console(12919): at ScriptCoreLibJava.BCLImplementation.System.Net.Sockets.__NetworkStream.Flush(__NetworkStream.java:58) count += y; // I/System.Console(15969): before ReadByte { Length = 40960 } //I/System.Console(15969): after ReadByte { y = 40960 } //I/System.Console(15969): { count = 0 } //I/System.Console(15969): before ReadByte { Length = 40960 } //I/System.Console(15969): after ReadByte { y = 19844 } //I/System.Console(15969): { count = 0 } //I/System.Console(15969): before ReadByte { Length = 40960 } //I/System.Console(15969): after ReadByte { y = -1 } //I/System.Console(15969): before dispose Console.WriteLine(new { count }); //} } // 26sec h.Context.Response.Write(new { count, e.ElapsedMilliseconds }.ToString()); h.CompleteRequest(); } // { count = 1806719 } }