Author: eyala
Date: 2007-01-14 12:20:40 -0500 (Sun, 14 Jan 2007)
New Revision: 70990
Added:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/IncludeHelperServlet.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/J2EEAuthenticationModule.cs
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseStaticHttpServlet.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ObjectInputStream.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ObjectOutputStream.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionIDManager.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateItemCollection.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEUtils.cs
Log:
Added J2EE Portal support.
Modified: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEUtils.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEUtils.cs 2007-01-14
17:11:06 UTC (rev 70989)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEUtils.cs 2007-01-14
17:20:40 UTC (rev 70990)
@@ -35,8 +35,21 @@
{
internal static class J2EEUtils
{
- public static string GetApplicationRealPath (ServletConfig
config) {
- string realFs = config.getInitParameter
(J2EEConsts.FILESYSTEM_ACCESS);
+ public static string GetInitParameterByHierarchy(ServletConfig
config, string name)
+ {
+ if (config == null)
+ throw new ArgumentNullException("config");
+
+ string value = config.getInitParameter(name);
+ if (value != null)
+ return value;
+
+ return
config.getServletContext().getInitParameter(name);
+ }
+
+ public static string GetApplicationRealPath (ServletConfig
config)
+ {
+ string realFs = GetInitParameterByHierarchy (config,
J2EEConsts.FILESYSTEM_ACCESS);
if (realFs == null || realFs == J2EEConsts.ACCESS_FULL)
{
try {
if (Path.IsPathRooted
(config.getServletContext ().getRealPath ("")))
@@ -55,7 +68,7 @@
public static string GetApplicationPhysicalPath (ServletConfig
config) {
string path = "";
ServletContext context = config.getServletContext ();
- string appDir = config.getInitParameter
(IAppDomainConfig.APP_DIR_NAME);
+ string appDir = GetInitParameterByHierarchy (config,
IAppDomainConfig.APP_DIR_NAME);
// Console.WriteLine("appdir =
{0}", appDir);
if (appDir != null) {
try {
@@ -81,4 +94,4 @@
return path;
}
}
-}
\ No newline at end of file
+}
Modified: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -42,10 +42,12 @@
public class BaseHttpServlet : HttpServlet
{
//private AppDomain _servletDomain;
- static LocalDataStoreSlot _servletRequestSlot =
Thread.GetNamedDataSlot(J2EEConsts.SERVLET_REQUEST);
- static LocalDataStoreSlot _servletResponseSlot =
Thread.GetNamedDataSlot(J2EEConsts.SERVLET_RESPONSE);
- static LocalDataStoreSlot _servletSlot =
Thread.GetNamedDataSlot(J2EEConsts.CURRENT_SERVLET);
+ static readonly LocalDataStoreSlot _servletRequestSlot =
Thread.GetNamedDataSlot(J2EEConsts.SERVLET_REQUEST);
+ static readonly LocalDataStoreSlot _servletResponseSlot =
Thread.GetNamedDataSlot(J2EEConsts.SERVLET_RESPONSE);
+ static readonly LocalDataStoreSlot _servletSlot =
Thread.GetNamedDataSlot(J2EEConsts.CURRENT_SERVLET);
+ bool _performedInit = false;
+
public BaseHttpServlet()
{
}
@@ -59,6 +61,9 @@
protected virtual void InitServlet(ServletConfig config)
{
+ if
(config.getServletContext().getAttribute(J2EEConsts.APP_DOMAIN) != null)
+ return;
+
try
{
AppDomain servletDomain =
createServletDomain(config);
@@ -76,6 +81,7 @@
servletDomain.SetData(J2EEConsts.RESOURCE_LOADER, new [EMAIL
PROTECTED](config.getServletContext()));
config.getServletContext().setAttribute(J2EEConsts.APP_DOMAIN, servletDomain);
+ _performedInit = true;
}
finally
{
@@ -84,8 +90,14 @@
}
}
- override protected void service (HttpServletRequest req,
HttpServletResponse resp)
+ protected override void service (HttpServletRequest req,
HttpServletResponse resp)
{
+ resp.setContentType("text/html");
+ service(req, resp, resp.getOutputStream());
+ }
+
+ public virtual void service(HttpServletRequest req,
HttpServletResponse resp, java.io.OutputStream output)
+ {
try
{
// Very important - to update Virtual Path!!!
@@ -96,22 +108,17 @@
// Put to the TLS current AppDomain of the
servlet, so anyone can use it.
[EMAIL PROTECTED](servletDomain);
- //put request to the TLS
+ // put request to the TLS
Thread.SetData(_servletRequestSlot, req);
- //put response to the TLS
+ // put response to the TLS
Thread.SetData(_servletResponseSlot, resp);
- //put the servlet object to the TLS
+ // put the servlet object to the TLS
Thread.SetData(_servletSlot, this);
-
-
resp.setHeader("X-Powered-By", "ASP.NET");
resp.setHeader("X-AspNet-Version", "1.1.4322");
- //PageMapper.LoadFileList();
-
- resp.setContentType("text/html");
- HttpWorkerRequest gwr = new
ServletWorkerRequest(this, req, resp);
+ HttpWorkerRequest gwr = new
ServletWorkerRequest(this, req, resp, output);
HttpRuntime.ProcessRequest(gwr);
}
finally
@@ -121,14 +128,15 @@
Thread.SetData(_servletResponseSlot, null);
Thread.SetData(_servletSlot, null);
[EMAIL PROTECTED]();
- //cleaning
- //vmw.Utils.cleanTLS(); //clean up all TLS
entries for current Thread.
-
//java.lang.Thread.currentThread().setContextClassLoader(null);
}
}
override public void destroy()
{
+ base.destroy();
+ if (!_performedInit)
+ return;
+
try
{
AppDomain servletDomain =
(AppDomain)this.getServletContext().getAttribute(J2EEConsts.APP_DOMAIN);
@@ -136,7 +144,6 @@
#if DEBUG
Console.WriteLine("Destroy of GhHttpServlet");
#endif
- base.destroy();
HttpRuntime.Close();
[EMAIL PROTECTED](this);
this.getServletContext().removeAttribute(J2EEConsts.APP_DOMAIN);
@@ -179,7 +186,7 @@
servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath);
//Set DataDirectory substitution string
(http://blogs.msdn.com/dataaccess/archive/2005/10/28/486273.aspx)
- string dataDirectory =
config.getServletContext().getInitParameter ("DataDirectory");
+ string dataDirectory =
J2EEUtils.GetInitParameterByHierarchy(config, "DataDirectory");
if (dataDirectory == null)
dataDirectory = "APP_DATA";
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseStaticHttpServlet.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseStaticHttpServlet.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseStaticHttpServlet.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -26,14 +26,14 @@
using System;
using System.IO;
using System.Configuration;
-using System.Web.Configuration;
+using System.Web;
using System.Threading;
using javax.servlet;
using javax.servlet.http;
using vmw.common;
-namespace System.Web.J2EE
+namespace Mainsoft.Web.Hosting
{
public class BaseStaticHttpServlet : HttpServlet
{
@@ -44,8 +44,7 @@
override public void init(ServletConfig config)
{
base.init(config);
- ServletContext context = config.getServletContext();
- AppDir =
config.getInitParameter(IAppDomainConfig.APP_DIR_NAME);
+ AppDir = J2EEUtils.GetInitParameterByHierarchy(config,
IAppDomainConfig.APP_DIR_NAME);
if (AppDir != null) {
AppDir = AppDir.Replace('\\', '/');
if (AppDir[AppDir.Length - 1] != '/')
@@ -55,18 +54,32 @@
override protected void service(HttpServletRequest req,
HttpServletResponse resp)
{
- String pathInfo = req.getRequestURI();
- String contextPath = req.getContextPath();
-
- pathInfo =
getServletContext().getRealPath(req.getServletPath());
resp.setHeader("X-Powered-By", "ASP.NET");
resp.setHeader("X-AspNet-Version", "1.1.4322");
- ServletOutputStream hos = resp.getOutputStream();
- String filename = pathInfo;
+ String filename =
getServletContext().getRealPath(req.getServletPath());
+ ServletOutputStream hos;
+ try {
+ hos = resp.getOutputStream();
+ }
+ catch (java.lang.IllegalStateException e)
+ {
+ string mimeType =
getServletContext().getMimeType(filename);
+ if (mimeType == null ||
mimeType.StartsWith("text")) {
+ sendFileUsingWriter(resp, filename);
+ return;
+ }
+ else
+ throw e;
+ }
try
{
-
resp.setContentType(this.getServletContext().getMimeType(filename));
+ string mimeType =
this.getServletContext().getMimeType(filename);
+ if (mimeType == null)
+ mimeType = "text/plain";
+
+ resp.setContentType(mimeType);
+
FileStream fis = null;
try {
fis = new
FileStream(filename,FileMode.Open,FileAccess.Read);
@@ -98,6 +111,43 @@
}
}
+ void sendFileUsingWriter(HttpServletResponse resp, string
filename)
+ {
+ java.io.PrintWriter writer = resp.getWriter();
+ try
+ {
+
resp.setContentType(this.getServletContext().getMimeType(filename));
+ StreamReader fis = null;
+ char[] buf = new char[4 * 1024]; // 4K buffer
+ try {
+ fis = new StreamReader(filename);
+ int charsRead;
+ while ((charsRead =
fis.Read(buf,0,buf.Length)) != -1 &&
+ charsRead != 0) {
+ writer.write(buf, 0, charsRead);
+ }
+ }
+ finally {
+ if (fis != null) fis.Close();
+ }
+ }
+ catch (System.IO.FileNotFoundException e)
+ {
+ resp.setStatus(404,"Object Not Found.");
+ HttpException myExp = new HttpException (404,
"File '" + filename + "' not found.");
+ writer.print(((HttpException)
myExp).GetHtmlErrorMessage ());
+ writer.flush();
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("ERROR in Static File Reading
{0},{1}",e.GetType(), e.Message);
+ resp.setStatus(500);
+ HttpException myExp = new HttpException
("Exception in Reading static file", e);
+ writer.print(((HttpException)
myExp).GetHtmlErrorMessage ());
+ writer.flush();
+ }
+ }
+
override public void destroy()
{
base.destroy();
@@ -107,10 +157,20 @@
}
}
+namespace System.Web.J2EE
+{
+ public class BaseStaticHttpServlet :
Mainsoft.Web.Hosting.BaseStaticHttpServlet
+ {
+ }
+
+}
+
+
namespace System.Web.GH
{
- public class BaseStaticHttpServlet :
System.Web.J2EE.BaseStaticHttpServlet
+ public class BaseStaticHttpServlet :
Mainsoft.Web.Hosting.BaseStaticHttpServlet
{
}
}
+
Added: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/IncludeHelperServlet.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/IncludeHelperServlet.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/IncludeHelperServlet.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -0,0 +1,119 @@
+//
+// Mainsoft.Web.Hosting.IncludeHelperServlet
+//
+// Authors:
+// Eyal Alaluf ([EMAIL PROTECTED])
+//
+// (C) 2006 Mainsoft Co. (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;
+using System.IO;
+using System.Web.UI;
+using java.io;
+using javax.servlet;
+using javax.servlet.http;
+using [EMAIL PROTECTED];
+
+namespace Mainsoft.Web.Hosting
+{
+ public class IncludeHelperServlet : HttpServlet
+ {
+ public IncludeHelperServlet()
+ {
+ }
+
+ override public void init(ServletConfig config)
+ {
+ base.init(config);
+ }
+
+ override protected void service(HttpServletRequest req,
HttpServletResponse resp)
+ {
+ string servletPath =
ServletIncludeUtils.getServletPath(req);
+ TextWriter writer =
(TextWriter)ServletIncludeUtils.getTextWriter(req);
+ RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(servletPath);
+ HttpServletResponseWrapper wrapper = new
AspxResponseWrapper(resp, writer);
+ dispatcher.include(req, wrapper);
+ }
+
+ override public void destroy()
+ {
+ base.destroy();
+ }
+
+ class AspxResponseWrapper : HttpServletResponseWrapper
+ {
+ public AspxResponseWrapper(HttpServletResponse resp,
TextWriter writer) : base (resp)
+ {
+ jwriter = new PrintWriter(new
JavaWriterFromTextWriter(writer));
+ }
+
+ public override PrintWriter getWriter()
+ {
+ return jwriter;
+ }
+
+ PrintWriter jwriter;
+ }
+
+ public class JavaWriterFromTextWriter : Writer
+ {
+ public JavaWriterFromTextWriter(TextWriter writer)
+ {
+ this.writer = writer;
+ }
+
+ public override void flush()
+ {
+ writer.Flush ();
+ }
+
+ public override void write(char[] buffer, int offset,
int count)
+ {
+ writer.Write(buffer, offset, count);
+ }
+
+ public override void write(String s)
+ {
+ writer.Write(s);
+ }
+
+ public override void write(string s, int start, int
count)
+ {
+ if (start == 0 && count == s.Length)
+ writer.Write(s);
+ else
+ writer.Write(s.Substring(start, count));
+ }
+
+ public override void close()
+ {
+ // Ignore close as we don't own here the writer.
+ }
+
+ TextWriter writer;
+ }
+ }
+}
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -27,7 +27,6 @@
using System.Text;
using System.Runtime.InteropServices;
using System.Web.Util;
-using vmw.common;
using System.Web.J2EE;
using System.Collections;
using System.Web;
@@ -36,14 +35,17 @@
using System.Collections.Specialized;
using System.Globalization;
using System.Web.Hosting;
+using vmw.common;
+using [EMAIL PROTECTED];
namespace Mainsoft.Web.Hosting {
[MonoTODO("Implement security demands on the path usage functions (and
review)")]
[ComVisible (false)]
- internal sealed class ServletWorkerRequest : HttpWorkerRequest {
+ internal sealed class ServletWorkerRequest : HttpWorkerRequest,
IServiceProvider {
readonly HttpServlet _HttpServlet;
readonly HttpServletRequest _HttpServletRequest;
readonly HttpServletResponse _HttpServletResponse;
+ java.io.OutputStream _OutputStream;
readonly string _requestUri;
readonly string _pathInfo;
@@ -93,10 +95,11 @@
KnownServerVariableMap[knownServerVariableNames[i]] = (KnownServerVariable)i;
}
- public ServletWorkerRequest (HttpServlet servlet,
HttpServletRequest req, HttpServletResponse resp) {
+ public ServletWorkerRequest (HttpServlet servlet,
HttpServletRequest req, HttpServletResponse resp, java.io.OutputStream
outputStream) {
_HttpServlet = servlet;
_HttpServletRequest = req;
_HttpServletResponse = resp;
+ _OutputStream = outputStream;
string contextPath = req.getContextPath();
string requestURI = req.getRequestURI();
@@ -119,6 +122,17 @@
}
}
+ public object GetService (Type serviceType)
+ {
+ if (serviceType == typeof(HttpServlet))
+ return Servlet;
+ if (serviceType == typeof(HttpServletRequest))
+ return ServletRequest;
+ if (serviceType == typeof(HttpServletResponse))
+ return ServletResponse;
+ return null;
+ }
+
public HttpServlet Servlet {
get {
return _HttpServlet;
@@ -151,13 +165,17 @@
public override void EndOfRequest () {
if (_endOfSendCallback != null)
_endOfSendCallback(this, _endOfSendArgs);
+ _OutputStream = null;
}
public override void FlushResponse (bool finalFlush) {
- ServletOutputStream servletOutputStream =
_HttpServletResponse.getOutputStream();
- servletOutputStream.flush();
+ IPortletActionResponse resp =_HttpServletResponse as
IPortletActionResponse;
+ if (_OutputStream == null || resp != null &&
resp.isRedirected())
+ return;
+
+ _OutputStream.flush();
if (finalFlush)
- servletOutputStream.close();
+ _OutputStream.close();
}
public override string GetAppPath () {
@@ -243,10 +261,9 @@
try {
return _HttpServletRequest.getRemotePort();
}
- catch(Exception e) { //should catch also
java.lang.Throwable
- //if servlet API is 2.3 and below - there is no
- //method getRemotePort in ServletRequest
interface...
- //should be described as limitation.
+ catch(Exception e) {
+ // if servlet API is 2.3 and below - there is
no method getRemotePort
+ // in ServletRequest interface... should be described as
limitation.
return 0;
}
}
@@ -351,8 +368,12 @@
}
public override void SendResponseFromMemory (byte [] data, int
length) {
+ IPortletActionResponse resp =_HttpServletResponse as
IPortletActionResponse;
+ if (_OutputStream == null || resp != null &&
resp.isRedirected())
+ return;
+
sbyte [] sdata =
vmw.common.TypeUtils.ToSByteArray(data);
- _HttpServletResponse.getOutputStream().write(sdata, 0 ,
length);
+ _OutputStream.write(sdata, 0 , length);
}
public override void SendStatus(int statusCode, string
statusDescription) {
Added:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/J2EEAuthenticationModule.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/J2EEAuthenticationModule.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/J2EEAuthenticationModule.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -0,0 +1,84 @@
+//
+// Mainsoft.Web.Security.J2EEAuthenticationModule
+//
+// Authors:
+// Eyal Alaluf ([EMAIL PROTECTED])
+//
+// (C) 2006 Mainsoft Co. (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;
+using System.Security.Principal;
+using System.Text;
+using System.Web;
+using System.Web.Configuration;
+using System.Web.Util;
+using javax.servlet;
+using javax.servlet.http;
+
+namespace Mainsoft.Web.Security
+{
+ public sealed class J2EEAuthenticationModule : IHttpModule
+ {
+ public void Dispose ()
+ {
+ }
+
+ public void Init (HttpApplication app)
+ {
+ app.AuthenticateRequest += new EventHandler
(OnAuthenticateRequest);
+ }
+
+ void OnAuthenticateRequest (object sender, EventArgs args)
+ {
+ HttpApplication app = (HttpApplication) sender;
+ HttpServletRequest req =
app.Context.Request.ServletWorkerRequest.ServletRequest;
+ if (req.getRemoteUser() != null)
+ app.Context.User = new J2EEPrincipal(req);
+ }
+ }
+
+ internal class J2EEPrincipal : IPrincipal
+ {
+ HttpServletRequest _request;
+ IIdentity _identity;
+
+ public J2EEPrincipal(HttpServletRequest req)
+ {
+ _request = req;
+ string authType = req.getAuthType();
+ if (authType == null)
+ authType = "";
+ _identity = new GenericIdentity(req.getRemoteUser(),
authType);
+ }
+
+ public bool IsInRole(string role)
+ {
+ return _request.isUserInRole(role);
+ }
+
+ public IIdentity Identity { get { return _identity; } }
+ }
+}
+
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ObjectInputStream.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ObjectInputStream.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ObjectInputStream.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -1,29 +1,29 @@
-//
-// (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.
//
+// (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;
using java.io;
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ObjectOutputStream.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ObjectOutputStream.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ObjectOutputStream.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -1,29 +1,29 @@
-//
-// (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.
//
+// (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;
using java.io;
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionIDManager.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionIDManager.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionIDManager.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -55,7 +55,7 @@
}
public void RemoveSessionID (HttpContext context) {
- ServletSessionStateStoreProvider.GetWorkerRequest
(context).ServletRequest.getSession (false).invalidate ();
+ ServletSessionStateStoreProvider.GetSession (context,
false).invalidate ();
}
public void SaveSessionID (HttpContext context, string id, out
bool redirected, out bool cookieAdded) {
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateItemCollection.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateItemCollection.cs
2007-01-14 17:11:06 UTC (rev 70989)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateItemCollection.cs
2007-01-14 17:20:40 UTC (rev 70990)
@@ -45,7 +45,7 @@
HttpStaticObjectsCollection _staticObjects;
bool _needSessionPersistence;
- public ServletSessionStateItemCollection () { } //for
deserialization
+ public ServletSessionStateItemCollection () {} // For
Java deserialization
public ServletSessionStateItemCollection (HttpContext
context)
: this () {
@@ -55,7 +55,7 @@
if (context != null) {
ServletConfig config =
ServletSessionStateStoreProvider.GetWorkerRequest
(context).Servlet.getServletConfig ();
- string sessionPersistance =
config.getInitParameter (J2EEConsts.Enable_Session_Persistency);
+ string sessionPersistance =
J2EEUtils.GetInitParameterByHierarchy(config,
J2EEConsts.Enable_Session_Persistency);
if (sessionPersistance == null)
sessionPersistance =
config.getServletContext().getInitParameter
(J2EEConsts.Enable_Session_Persistency);
if (sessionPersistance != null) {
@@ -155,8 +155,13 @@
public void readExternal (java.io.ObjectInput input) {
lock (this) {
_needSessionPersistence =
input.readBoolean ();
- if (!_needSessionPersistence) //noting
has been written
+ if (!_needSessionPersistence) {
//nothing has been written
+ if (_items == null)
+ _items = new
SessionStateItemCollection ();
+ if (_staticObjects == null)
+ _staticObjects = new
HttpStaticObjectsCollection ();
return;
+ }
ObjectInputStream ms = new
ObjectInputStream (input);
System.IO.BinaryReader br = new
System.IO.BinaryReader (ms);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches