Author: kostat
Date: 2006-01-09 10:53:24 -0500 (Mon, 09 Jan 2006)
New Revision: 55231
Added:
trunk/mcs/class/System.Web/System.Web.J2EE/ObjectInputStream.cs
trunk/mcs/class/System.Web/System.Web.J2EE/ObjectOutputStream.cs
Modified:
trunk/mcs/class/System.Web/System.Web.J2EE/BaseHttpServlet.cs
trunk/mcs/class/System.Web/System.Web.J2EE/ChangeLog
trunk/mcs/class/System.Web/System.Web.J2EE/J2EEUtils.cs
trunk/mcs/class/System.Web/System.Web.J2EE/PageMapper.cs
Log:
merging latest changes
Modified: trunk/mcs/class/System.Web/System.Web.J2EE/BaseHttpServlet.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.J2EE/BaseHttpServlet.cs
2006-01-09 15:33:54 UTC (rev 55230)
+++ trunk/mcs/class/System.Web/System.Web.J2EE/BaseHttpServlet.cs
2006-01-09 15:53:24 UTC (rev 55231)
@@ -60,8 +60,6 @@
try
{
AppDomain servletDomain =
createServletDomain(config);
- if(servletDomain == null)
- throw new ArgumentException("cannot
initialize AppDomain!");
//GH Infromation Initizalization
servletDomain.SetData(J2EEConsts.CLASS_LOADER,
vmw.common.TypeUtils.ToClass(this).getClassLoader());
@@ -80,11 +78,6 @@
{
try
{
- String pathInfo = req.getRequestURI();
- String contextPath = req.getContextPath();
- if (pathInfo.Equals(contextPath) ||
- ((pathInfo.Length - contextPath.Length)
== 1) && pathInfo[pathInfo.Length-1] == '/' && pathInfo.StartsWith(contextPath))
- pathInfo = contextPath +
req.getServletPath();
// Very important - to update Virtual Path!!!
AppDomain servletDomain =
(AppDomain)this.getServletContext().getAttribute(J2EEConsts.APP_DOMAIN);
servletDomain.SetData(IAppDomainConfig.APP_VIRT_DIR, req.getContextPath());
@@ -100,8 +93,7 @@
resp.setHeader("X-Powered-By", "ASP.NET");
resp.setHeader("X-AspNet-Version", "1.1.4322");
- ServletOutputStream hos =
resp.getOutputStream();
- PageMapper.LoadFileList();
+// PageMapper.LoadFileList();
resp.setContentType("text/html");
HttpWorkerRequest gwr = new
ServletWorkerRequest(this, req, resp, resp.getOutputStream());
@@ -146,8 +138,6 @@
private AppDomain createServletDomain(ServletConfig config)
{
- try
- {
string rootPath =
J2EEUtils.GetApplicationRealPath(config);
AppDomainSetup domainSetup = new
AppDomainSetup();
string name =
config.getServletName();//.getServletContextName();
@@ -183,13 +173,6 @@
//servletDomain.SetData(".hostingVirtualPath",
"/");
servletDomain.SetData(".hostingInstallDir",
"/");
return servletDomain;
- }
- catch(Exception e)
- {
- Console.WriteLine("ERROR in createServletDomain
{0},{1}",e.GetType(), e.Message);
- Console.WriteLine(e.StackTrace);
- return null;
- }
}
virtual protected [EMAIL PROTECTED] GetDeserializer()
Modified: trunk/mcs/class/System.Web/System.Web.J2EE/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.J2EE/ChangeLog 2006-01-09
15:33:54 UTC (rev 55230)
+++ trunk/mcs/class/System.Web/System.Web.J2EE/ChangeLog 2006-01-09
15:53:24 UTC (rev 55231)
@@ -1,3 +1,10 @@
+2006-01-09 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * BaseHttpServlet.cs: merging main/32, main/33
+ * PageMapper.cs: merging main/17-27
+ * J2EEUtils.cs: mergind ghutils.cs@@/main/9
+ * Added ObjectInputStream.cs, ObjectOutputStream.cs
+
2005-09-08 Eyal Alalouf <[EMAIL PROTECTED]>
* BaseHttpServlet.cs, PageMapper.cs, BaseStaticHttpServlet.cs,
SessionListener.cs - backward compatibility fixes.
Modified: trunk/mcs/class/System.Web/System.Web.J2EE/J2EEUtils.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.J2EE/J2EEUtils.cs 2006-01-09
15:33:54 UTC (rev 55230)
+++ trunk/mcs/class/System.Web/System.Web.J2EE/J2EEUtils.cs 2006-01-09
15:53:24 UTC (rev 55231)
@@ -65,7 +65,7 @@
string path = "";
ServletContext context = config.getServletContext();
string appDir =
config.getInitParameter(IAppDomainConfig.APP_DIR_NAME);
- Console.WriteLine("appdir = {0}", appDir);
+// Console.WriteLine("appdir = {0}", appDir);
if (appDir != null)
{
try
@@ -73,7 +73,7 @@
java.io.File f = new
java.io.File(appDir);
if(f.exists())
{
- Console.WriteLine("Physical
path= {0}", appDir);
+// Console.WriteLine("Physical
path= {0}", appDir);
path = appDir;
}
}
@@ -91,7 +91,7 @@
if (!path.EndsWith ("/") && !path.EndsWith ("\\"))
path += "/";
- Console.WriteLine("Physical path= {0}", path);
+// Console.WriteLine("Physical path= {0}", path);
return path;
}
Added: trunk/mcs/class/System.Web/System.Web.J2EE/ObjectInputStream.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.J2EE/ObjectInputStream.cs
2006-01-09 15:33:54 UTC (rev 55230)
+++ trunk/mcs/class/System.Web/System.Web.J2EE/ObjectInputStream.cs
2006-01-09 15:53:24 UTC (rev 55231)
@@ -0,0 +1,107 @@
+//
+// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
+//
+// Authors:
+// Vladimir Krasnov <[EMAIL PROTECTED]>
+// Konstantin Triger <[EMAIL PROTECTED]>
+//
+// 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;
+
+namespace System.Web.J2EE
+{
+ internal class ObjectInputStream : System.IO.Stream {
+ readonly java.io.ObjectInput _javaObjectInput;
+
+ public ObjectInputStream(java.io.ObjectInput stream) {
+ _javaObjectInput = stream;
+ }
+
+ public override bool CanRead {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return true;
+ }
+ }
+
+ public override long Length {
+ get {
+ throw new NotSupportedException();
+ }
+ }
+
+ public override long Position {
+ get {
+ throw new NotSupportedException();
+ }
+ set {
+ throw new NotSupportedException();
+ }
+ }
+
+ public override void Flush() {
+ throw new NotSupportedException();
+ }
+
+ public override long Seek(long offset, System.IO.SeekOrigin
origin) {
+ if (origin == System.IO.SeekOrigin.Current)
+ return _javaObjectInput.skip(offset);
+
+ throw new NotSupportedException();
+ }
+
+ public override void SetLength(long value) {
+ throw new NotSupportedException();
+ }
+
+ public override int Read(byte[] buffer, int offset, int count) {
+ return
_javaObjectInput.read(vmw.common.TypeUtils.ToSByteArray(buffer), offset, count);
+ }
+
+ public override void Write(byte[] buffer, int offset, int
count) {
+ throw new NotSupportedException();
+ }
+
+ public override int ReadByte() {
+ return _javaObjectInput.read();
+ }
+
+ public override void Close() {
+ _javaObjectInput.close();
+ }
+
+ public java.io.ObjectInput NativeStream {
+ get {return _javaObjectInput;}
+ }
+ }
+}
Property changes on:
trunk/mcs/class/System.Web/System.Web.J2EE/ObjectInputStream.cs
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/mcs/class/System.Web/System.Web.J2EE/ObjectOutputStream.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.J2EE/ObjectOutputStream.cs
2006-01-09 15:33:54 UTC (rev 55230)
+++ trunk/mcs/class/System.Web/System.Web.J2EE/ObjectOutputStream.cs
2006-01-09 15:53:24 UTC (rev 55231)
@@ -0,0 +1,104 @@
+//
+// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
+//
+// Authors:
+// Vladimir Krasnov <[EMAIL PROTECTED]>
+// Konstantin Triger <[EMAIL PROTECTED]>
+//
+// 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;
+
+namespace System.Web.J2EE
+{
+ internal class ObjectOutputStream : System.IO.Stream {
+ readonly java.io.ObjectOutput _javaObjectOutput;
+
+ public ObjectOutputStream(java.io.ObjectOutput stream) {
+ _javaObjectOutput = stream;
+ }
+
+ public override bool CanRead {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return true;
+ }
+ }
+
+ public override void Close() {
+ _javaObjectOutput.close();
+ }
+
+ public override void Flush() {
+ _javaObjectOutput.flush();
+ }
+
+ public override long Length {
+ get {
+ throw new NotSupportedException();
+ }
+ }
+
+ public override long Position {
+ get {
+ throw new NotSupportedException();
+ }
+ set {
+ throw new NotSupportedException();
+ }
+ }
+
+ public override long Seek(long offset, System.IO.SeekOrigin
origin) {
+ throw new NotSupportedException();
+ }
+
+ public override void SetLength(long value) {
+ throw new NotSupportedException();
+ }
+
+ public override int Read(byte[] buffer, int offset, int count) {
+ throw new NotSupportedException();
+ }
+
+ public override void Write(byte[] buffer, int offset, int
count) {
+ _javaObjectOutput.write(
vmw.common.TypeUtils.ToSByteArray(buffer), offset, count );
+ }
+
+ public override void WriteByte(byte value) {
+ _javaObjectOutput.write(value);
+ }
+
+ public java.io.ObjectOutput NativeStream {
+ get {return _javaObjectOutput;}
+ }
+ }
+}
Property changes on:
trunk/mcs/class/System.Web/System.Web.J2EE/ObjectOutputStream.cs
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/mcs/class/System.Web/System.Web.J2EE/PageMapper.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.J2EE/PageMapper.cs 2006-01-09
15:33:54 UTC (rev 55230)
+++ trunk/mcs/class/System.Web/System.Web.J2EE/PageMapper.cs 2006-01-09
15:53:24 UTC (rev 55231)
@@ -40,27 +40,37 @@
public class PageMapper
{
private static readonly string _fileListName = "/filelist.xml";
+ private static readonly object LOCK_GETASSEMBLIESCACHEDDOCUMENT
= new object();
+ private static readonly object LOCK_GETFROMMAPPATHCACHE = new
object();
public static string GetFromMapPathCache(string key)
{
- Hashtable answer = (Hashtable)
AppDomain.CurrentDomain.GetData(J2EEConsts.MAP_PATH_CACHE);
- if (answer == null)
+ Hashtable answer = null;
+ lock(LOCK_GETFROMMAPPATHCACHE)
{
- answer = new Hashtable();
- CachedDocumentTypeStorage storage =
(CachedDocumentTypeStorage)GetAssembliesCachedDocument();
- IDictionaryEnumerator e =
storage.GetEnumerator();
- e.Reset();
- while (e.MoveNext())
- {
- string currentFile =
(string)((DictionaryEntry)e.Current).Key;
- answer[currentFile]=
IAppDomainConfig.WAR_ROOT_SYMBOL + currentFile;
+ answer = (Hashtable)
AppDomain.CurrentDomain.GetData(J2EEConsts.MAP_PATH_CACHE);
+ if (answer == null)
+ {
+ answer = new Hashtable();
+ CachedDocumentTypeStorage storage =
(CachedDocumentTypeStorage)GetAssembliesCachedDocument();
+ IDictionaryEnumerator e =
storage.GetEnumerator();
+ e.Reset();
+ while (e.MoveNext())
+ {
+ string currentFile =
(string)((DictionaryEntry)e.Current).Key;
+ answer[currentFile]=
IAppDomainConfig.WAR_ROOT_SYMBOL + currentFile;
+ }
+
AppDomain.CurrentDomain.SetData(J2EEConsts.MAP_PATH_CACHE,answer);
+
}
-
AppDomain.CurrentDomain.SetData(J2EEConsts.MAP_PATH_CACHE,answer);
-
}
return (string)answer[key];
}
+ // UNUSED METHOD
+ //The method was used by runtime to force file names
casesensitivity
+ // problem. The filelist.xml file should contain correct file
names,
+ // but currently it is unused
public static void LoadFileList()
{
Hashtable hashTable = (Hashtable)
AppDomain.CurrentDomain.GetData(J2EEConsts.FILE_LIST_FILE);
@@ -70,6 +80,12 @@
try
{
Stream fs =
(Stream)IOUtils.getStream(_fileListName);
+ if (fs == null)
+ {
+
AppDomain.CurrentDomain.SetData(J2EEConsts.FILE_LIST_FILE, new Hashtable());
+ return;
+ }
+
doc = new XmlDocument();
doc.Load(fs);
}
@@ -94,11 +110,10 @@
}
}
- private static readonly object LOCK_OBJECT = new object();
private static ICachedXmlDoc GetAssembliesCachedDocument()
{
- lock(LOCK_OBJECT)
+ lock(LOCK_GETASSEMBLIESCACHEDDOCUMENT)
{
ICachedXmlDoc doc = (ICachedXmlDoc)
AppDomain.CurrentDomain.GetData(J2EEConsts.ASSEMBLIES_FILE);
if (doc == null)
@@ -129,9 +144,7 @@
if (url.StartsWith(IAppDomainConfig.WAR_ROOT_SYMBOL))
url =
url.Substring(IAppDomainConfig.WAR_ROOT_SYMBOL.Length);
- string query = url.ToLower();
-
- Type t = (Type) doc.Get(query);
+ Type t = doc.Get(url);
if (t == null)
throw new HttpException(404,"The requested
resource (" + url + ") is not available.");
@@ -142,7 +155,7 @@
#region ICachedXmlDoc interface
interface ICachedXmlDoc
{
- object Get(object key);
+ Type Get(string key);
//bool ContainsKey(object key);
}
#endregion
@@ -159,18 +172,16 @@
private CachedDocumentTypeStorage(int initTableSize)
{
- _table = new Hashtable(initTableSize);
+ _table = Hashtable.Synchronized(new
Hashtable(initTableSize));
}
public CachedDocumentTypeStorage() :
this(DEFAULT_PAGES_NUMBER)
{}
- object ICachedXmlDoc.Get(object o)
+ Type ICachedXmlDoc.Get(string o)
{
- if(o is string)
- return GetTypeByURL((string) o);
- throw new ArgumentException("the key should be
a string");
+ return GetTypeByURL(o);
}
internal IDictionaryEnumerator GetEnumerator()
@@ -180,14 +191,19 @@
public Type GetTypeByURL(string url)
{
- if (!_table.ContainsKey(url))
+ string lwUrl = url.ToLower();
+ lock (_table)
{
- PageCompiler compiler = new
PageCompiler(url);
- _table[url] = compiler.GetCachedType();
+ object retVal = _table[lwUrl];
+ if (retVal == null)
+ {
+ PageCompiler compiler = new
PageCompiler(url);
+ retVal =
compiler.GetCachedType();
+ _table[lwUrl] = retVal;
+ }
+
+ return (Type)retVal;
}
-
-
- return (Type)_table[url];
}
}
#endregion
@@ -229,7 +245,10 @@
Console.WriteLine(descPath);
#endif
Stream fs = (Stream)IOUtils.getStream("/" +
descPath);
- typeName = GetTypeFromDescStream(fs);
+ if (fs != null)
+ {
+ typeName = GetTypeFromDescStream(fs);
+ }
}
catch (Exception ex)
{
@@ -250,10 +269,17 @@
if (fileName.ToLower() != "global.asax"
&& fileName.ToLower() !=
"defaultwsdlhelpgenerator.aspx")
{
- //type not found - run aspxparser
- string[] command = GetParserCmd();
- if (J2EEUtils.RunProc(command) != 0)
- throw GetCompilerError();
+ string fullFileName =
HttpContext.Current.Request.MapPath(_url);
+ if ( File.Exists(fullFileName) ) {
+ //type not found - run aspxparser
+ string[] command = GetParserCmd();
+ if (J2EEUtils.RunProc(command) != 0)
+ throw GetCompilerError();
+ }
+ else {
+ string message = "The requested
resource (" + _url + ") is not available.";
+ throw new HttpException(404, message);
+ }
}
//if the desciptor exists in the real app dir - get the
type
try
@@ -363,15 +389,10 @@
if (file != null)
{
- try {
- Location loc = new Location(null);
- loc.Filename = file;
- loc.BeginLine = int.Parse(lineInFile);
- return new ParseException(loc,message);
- }
- // If file doesn't exist, or is unreadable just
go on and send
- // the original error message.
- catch(Exception e) {}
+ Location loc = new Location(null);
+ loc.Filename = file;
+ loc.BeginLine = int.Parse(lineInFile);
+ return new ParseException(loc,message);
}
if (message.IndexOf(typeof(FileNotFoundException).Name)
!= -1 &&
@@ -381,10 +402,3 @@
}
}
}
-
-namespace System.Web.GH
-{
- public class PageMapper : System.Web.J2EE.PageMapper
- {
- }
-}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches