Making simple web app work with Grasshopper.
authorEyal Alalouf <eyala@mainsoft.com>
Sun, 24 Jul 2005 15:49:31 +0000 (15:49 -0000)
committerEyal Alalouf <eyala@mainsoft.com>
Sun, 24 Jul 2005 15:49:31 +0000 (15:49 -0000)
svn path=/trunk/mcs/; revision=47606

mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/PageHandlerFactory.jvm.cs [new file with mode: 0644]
mcs/class/System.Web/System.Web.UI/TemplateControl.jvm.cs

index df57de5e6b7d74c8c09b3e4fdf5e6eea1ac56100..ec39a487b713f5dccf0c2da8f073da969c9439bc 100644 (file)
@@ -1,3 +1,7 @@
+2005-07-24 Eyal Alaluf (eyala@mainsoft.com)
+       * TemplateControl.jvm.cs: fixed resource loading
+    * PageHandlerFactory.jvm.cs: Added file
+
 2005-07-19 Eyal Alaluf (eyala@mainsoft.com)
        * Added TemplateControl.jvm.cs that implements Grasshopper (TARGET_J2EE)
          limited model of compiling ASP pages.
diff --git a/mcs/class/System.Web/System.Web.UI/PageHandlerFactory.jvm.cs b/mcs/class/System.Web/System.Web.UI/PageHandlerFactory.jvm.cs
new file mode 100644 (file)
index 0000000..59e3dc2
--- /dev/null
@@ -0,0 +1,50 @@
+//
+// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Web;
+using System.Web.J2EE;
+using vmw.common;
+//using System.Web.Compilation;
+
+
+namespace System.Web.UI
+{
+       public class PageHandlerFactory : IHttpHandlerFactory
+       {
+               public virtual IHttpHandler GetHandler (HttpContext context, string requestType, string url, string path)
+               {
+                       if (!path.StartsWith(IAppDomainConfig.WAR_ROOT_SYMBOL)) 
+                               path = context.Request.MapPath(path);
+                       Type tmpType = PageMapper.GetObjectType(path);
+                       Object obj = Activator.CreateInstance(tmpType);
+                       return (IHttpHandler) obj;
+               }
+
+               public virtual void ReleaseHandler (IHttpHandler handler)
+               {
+               }
+       }
+}
+
index d35a5d9dfe9ca34d0bd6d30713ce24316257016b..2a5f8b4dde0fd8489c4a6e27e9ce2e9e690e06c6 100644 (file)
@@ -298,9 +298,6 @@ namespace System.Web.UI {
                        string assemblyName = "dll.ghres";
                        
                        java.io.InputStream inputStream = contextClassLoader.getResourceAsStream(assemblyName);
-                       if (inputStream == null)
-                               throw new System.IO.IOException("couldn't open resource file:" + assemblyName);
-                       
                        System.IO.Stream strim = null;
                        if (inputStream == null) {
                                string descPath = String.Join("/", new string[]{"assemblies", this.GetType().Assembly.GetName().Name, assemblyName});
@@ -315,13 +312,11 @@ namespace System.Web.UI {
                                if (strim == null)
                                        throw new System.IO.IOException("couldn't open resource file:" + assemblyName);
                        }
-                       
-                       
+
                        try
                        {
                                if (strim == null)
                                        strim = (System.IO.Stream)vmw.common.IOUtils.getStream(inputStream);
-                               strim = (System.IO.Stream)vmw.common.IOUtils.getStream(inputStream);
                                int capacity = (int)strim.Length;
                                byte[] resourceBytes = new byte[capacity];
                                strim.Read(resourceBytes,0,capacity);