Author: igorz
Date: 2007-12-23 07:08:33 -0500 (Sun, 23 Dec 2007)
New Revision: 91825
Added:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/AspNetFacesContext.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesPageHandlerFactory.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesStateManager.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesViewHandler.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesContext.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandler.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandlerFactory.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesStateManager.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesViewHandler.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/SessionWrapper.cs
Modified:
trunk/mcs/class/Mainsoft.Web/
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/OutputStreamWrapper.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.csproj
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/DerbyDBSchema.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/ServletAuthenticationModule.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.SessionState/ServletSessionStateStoreProvider.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/SessionListener.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEConsts.cs
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEUtils.cs
Log:
for TARGET_J2EE only:
implement integration with JSF.
Property changes on: trunk/mcs/class/Mainsoft.Web
___________________________________________________________________
Name: svn:ignore
+ bin
obj
Refs
Modified: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEConsts.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEConsts.cs 2007-12-23
10:43:31 UTC (rev 91824)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEConsts.cs 2007-12-23
12:08:33 UTC (rev 91825)
@@ -27,7 +27,7 @@
namespace Mainsoft.Web
{
- internal static class J2EEConsts
+ public static class J2EEConsts
{
public const string SESSION_STATE = "GH_SESSION_STATE";
Modified: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEUtils.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEUtils.cs 2007-12-23
10:43:31 UTC (rev 91824)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web/J2EEUtils.cs 2007-12-23
12:08:33 UTC (rev 91825)
@@ -32,33 +32,34 @@
using javax.servlet;
using System.Web;
using Mainsoft.Web.Hosting;
+using System.Diagnostics;
namespace Mainsoft.Web
{
internal static class J2EEUtils
{
- public static string GetInitParameterByHierarchy(ServletConfig
config, string name)
- {
- if (config == null)
- throw new ArgumentNullException("config");
+ //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;
+ // string value = config.getInitParameter(name);
+ // if (value != null)
+ // return value;
- return
config.getServletContext().getInitParameter(name);
- }
+ // return config.getServletContext().getInitParameter(name);
+ //}
- public static string GetApplicationRealPath (ServletConfig
config) {
- return GetApplicationRealPath (config, "/");
+ public static string GetApplicationRealPath (ServletContext
context) {
+ return GetApplicationRealPath (context, "/");
}
- public static string GetApplicationRealPath (ServletConfig
config, string appVirtualPath)
+ public static string GetApplicationRealPath (ServletContext
context, string appVirtualPath)
{
- string realFs = GetInitParameterByHierarchy (config,
J2EEConsts.FILESYSTEM_ACCESS);
+ string realFs = context.getInitParameter
(J2EEConsts.FILESYSTEM_ACCESS);
if (realFs == null || realFs == J2EEConsts.ACCESS_FULL)
{
try {
- string realPath =
config.getServletContext ().getRealPath (appVirtualPath);
+ string realPath = context.getRealPath
(appVirtualPath);
if (!String.IsNullOrEmpty (realPath)) {
if (!String.IsNullOrEmpty
(appVirtualPath) &&
appVirtualPath
[appVirtualPath.Length - 1] == '/')
@@ -69,40 +70,35 @@
}
}
catch (Exception e) {
-#if TRACE
- Console.WriteLine (e.ToString());
-#endif
+ Trace.WriteLine (e.ToString());
}
}
return IAppDomainConfig.WAR_ROOT_SYMBOL +
appVirtualPath;
}
- public static string GetApplicationPhysicalPath (ServletConfig
config) {
+ public static string GetApplicationPhysicalPath (ServletContext
context) {
string path = String.Empty;
- ServletContext context = config.getServletContext ();
- string appDir = GetInitParameterByHierarchy (config,
IAppDomainConfig.APP_DIR_NAME);
+ string appDir =
context.getInitParameter(IAppDomainConfig.APP_DIR_NAME);
if (appDir != null) {
try {
if (Directory.Exists(appDir))
path = appDir;
}
catch (Exception e) {
-#if TRACE
- Console.WriteLine (e.Message + appDir +
"is invalid or unaccessible." +
+ Trace.WriteLine (e.Message + appDir +
"is invalid or unaccessible." +
" If " + appDir + " really
exists, check your security permissions");
-#endif
}
}
if (path.Length == 0)
- path = GetApplicationRealPath (config);
+ path = GetApplicationRealPath (context);
return path;
}
- static internal ServletWorkerRequest GetWorkerRequest
(HttpContext context) {
+ static internal BaseWorkerRequest GetWorkerRequest (HttpContext
context) {
IServiceProvider sp = (IServiceProvider) context;
- return (ServletWorkerRequest) sp.GetService (typeof
(HttpWorkerRequest));
+ return (BaseWorkerRequest) sp.GetService (typeof
(HttpWorkerRequest));
}
}
}
Copied: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/AspNetFacesContext.cs
(from rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/AspNetFacesContext.cs)
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesPageHandlerFactory.cs
(from rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesPageHandlerFactory.cs)
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesStateManager.cs
(from rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesStateManager.cs)
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesViewHandler.cs (from
rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseFacesViewHandler.cs)
Modified: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseHttpServlet.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -40,6 +40,7 @@
using java.lang.reflect;
using java.net;
using System.Globalization;
+using System.Diagnostics;
namespace Mainsoft.Web.Hosting
{
@@ -49,9 +50,9 @@
public class BaseHttpServlet : HttpServlet
{
//private AppDomain _servletDomain;
- 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);
+ //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 _appVirDirInited = false;
@@ -62,73 +63,43 @@
override public void init(ServletConfig config)
{
base.init(config);
- InitServlet(config);
-
+ InitRuntime (config, this);
}
- protected virtual void InitServlet(ServletConfig config)
- {
- if
(config.getServletContext().getAttribute(J2EEConsts.APP_DOMAIN) != null)
- return;
+ public static void InitRuntime (ServletConfig config, object
evidence) {
+ AppDomain servletDomain = createServletDomain (config);
+ [EMAIL PROTECTED] (servletDomain);
- try
- {
- AppDomain servletDomain =
createServletDomain(config);
- [EMAIL PROTECTED](servletDomain);
-
+ try {
+ ServletContext context =
config.getServletContext ();
//GH Infromation Initizalization
- int nowInt =
DateTime.Now.ToString().GetHashCode();
- servletDomain.SetData(".domainId",
nowInt.ToString("x"));
- nowInt += "/".GetHashCode ();
- servletDomain.SetData(".appId",
nowInt.ToString("x"));
- servletDomain.SetData(".appName",
nowInt.ToString("x"));
+ long currentTime =
java.lang.System.currentTimeMillis ();
+ servletDomain.SetData (".domainId",
currentTime.ToString ("x"));
+ currentTime = ~currentTime;
+ servletDomain.SetData (".appId",
currentTime.ToString ("x"));
+ servletDomain.SetData (".appName",
servletDomain.SetupInformation.ApplicationName);
- servletDomain.SetData(J2EEConsts.CLASS_LOADER,
vmw.common.TypeUtils.ToClass(this).getClassLoader());
-
servletDomain.SetData(J2EEConsts.SERVLET_CONFIG, config);
-
servletDomain.SetData(J2EEConsts.RESOURCE_LOADER, new [EMAIL
PROTECTED](config.getServletContext()));
+ servletDomain.SetData (J2EEConsts.CLASS_LOADER,
java.lang.Thread.currentThread ().getContextClassLoader ());
+ //servletDomain.SetData
(J2EEConsts.CLASS_LOADER, vmw.common.TypeUtils.ToClass
(evidence).getClassLoader ());
+
//servletDomain.SetData(J2EEConsts.SERVLET_CONFIG, config);
+ servletDomain.SetData
(J2EEConsts.RESOURCE_LOADER, new [EMAIL PROTECTED] (context));
-
config.getServletContext().setAttribute(J2EEConsts.APP_DOMAIN, servletDomain);
- config.getServletContext ().setAttribute
(J2EEConsts.CURRENT_SERVLET, this);
+ lock (evidence) {
+ if (context.getAttribute
(J2EEConsts.APP_DOMAIN) == null)
+ context.setAttribute
(J2EEConsts.APP_DOMAIN, servletDomain);
+ }
+ //config.getServletContext ().setAttribute
(J2EEConsts.CURRENT_SERVLET, this);
}
- finally
- {
- [EMAIL PROTECTED]();
- [EMAIL PROTECTED]();
+ finally {
+ [EMAIL PROTECTED] ();
+ [EMAIL PROTECTED] ();
}
}
protected override void service (HttpServletRequest req,
HttpServletResponse resp)
{
- const string assemblies = "/assemblies";
- const string getping = "getping";
- const string setping = "setping";
- string servletPath = req.getServletPath ();
+ resp.setContentType ("text/html");
- if (String.CompareOrdinal (assemblies, 0, servletPath,
0, assemblies.Length) == 0) {
- if (servletPath.Length == assemblies.Length ||
- servletPath [assemblies.Length] == '/')
{
- string requestURI = req.getRequestURI
();
- bool getp = requestURI.EndsWith
(getping, StringComparison.Ordinal);
- if (!getp && requestURI.EndsWith
(setping, StringComparison.Ordinal)) {
- getServletContext
().setAttribute (getping, "1");
- getp = true;
- }
-
- if (getp) {
- string ping = (string)
getServletContext ().getAttribute (getping);
- if (ping == null)
- ping = "0";
- resp.getOutputStream ().print
(ping);
- return;
- }
- }
- }
- resp.setContentType("text/html");
- service(req, resp, false);
- }
-
- public virtual void service(HttpServletRequest req,
HttpServletResponse resp, bool alwaysUsePrintWriter)
- {
try
{
// Very important - to update Virtual Path!!!
@@ -143,16 +114,16 @@
[EMAIL PROTECTED](servletDomain);
// put request to the TLS
- Thread.SetData(_servletRequestSlot, req);
- // put response to the TLS
- Thread.SetData(_servletResponseSlot, resp);
- // put the servlet object to the TLS
- Thread.SetData(_servletSlot, this);
+ //Thread.SetData(_servletRequestSlot, req);
+ //// put response to the TLS
+ //Thread.SetData(_servletResponseSlot, resp);
+ //// 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");
- HttpWorkerRequest gwr = new
ServletWorkerRequest (this, req, resp, alwaysUsePrintWriter);
+ HttpWorkerRequest gwr = new
ServletWorkerRequest (this, req, resp);
CultureInfo culture = (CultureInfo) [EMAIL
PROTECTED] (req.getLocale ());
Thread currentTread = Thread.CurrentThread;
currentTread.CurrentCulture = culture;
@@ -162,9 +133,9 @@
finally
{
HttpContext.Current = null;
- Thread.SetData(_servletRequestSlot, null);
- Thread.SetData(_servletResponseSlot, null);
- Thread.SetData(_servletSlot, null);
+ //Thread.SetData(_servletRequestSlot, null);
+ //Thread.SetData(_servletResponseSlot, null);
+ //Thread.SetData(_servletSlot, null);
[EMAIL PROTECTED]();
}
}
@@ -172,37 +143,34 @@
override public void destroy()
{
base.destroy();
- AppDomain servletDomain = (AppDomain) getServletContext
().getAttribute (J2EEConsts.APP_DOMAIN);
+ DestroyRuntime (getServletContext (), this);
+ }
+
+ public static void DestroyRuntime (ServletContext context,
object evidence) {
+ AppDomain servletDomain = (AppDomain)
context.getAttribute (J2EEConsts.APP_DOMAIN);
if (servletDomain == null)
return;
- try
- {
- [EMAIL PROTECTED](servletDomain);
-#if DEBUG
- Console.WriteLine("Destroy of GhHttpServlet");
-#endif
- HttpRuntime.Close();
- [EMAIL PROTECTED](this);
-
this.getServletContext().removeAttribute(J2EEConsts.APP_DOMAIN);
-
java.lang.Thread.currentThread().setContextClassLoader(null);
+ try {
+ [EMAIL PROTECTED] (servletDomain);
+ Debug.WriteLine ("Destroy of GhHttpServlet");
+ HttpRuntime.Close ();
+ [EMAIL PROTECTED] (evidence);
+ context.removeAttribute (J2EEConsts.APP_DOMAIN);
+ java.lang.Thread.currentThread
().setContextClassLoader (null);
}
- catch(Exception e)
- {
-#if DEBUG
- Console.WriteLine("ERROR in Servlet Destroy
{0},{1}",e.GetType(), e.Message);
- Console.WriteLine(e.StackTrace);
-#endif
+ catch (Exception e) {
+ Debug.WriteLine (String.Format ("ERROR in
Servlet Destroy {0},{1}", e.GetType (), e.Message));
+ Debug.WriteLine (e.StackTrace);
}
- finally
- {
- [EMAIL PROTECTED]();
+ finally {
+ [EMAIL PROTECTED] ();
}
}
- private AppDomain createServletDomain(ServletConfig config)
+ private static AppDomain createServletDomain(ServletConfig
config)
{
- string rootPath =
J2EEUtils.GetApplicationRealPath(config);
+ string rootPath =
J2EEUtils.GetApplicationRealPath(config.getServletContext ());
AppDomainSetup domainSetup = new
AppDomainSetup();
string name =
config.getServletName();//.getServletContextName();
if (name == null)
@@ -220,11 +188,11 @@
//servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR,
J2EEUtils.GetApplicationPhysicalPath(config));
//servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath);
-
servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR,
J2EEUtils.GetApplicationPhysicalPath(config));
+
servletDomain.SetData(IAppDomainConfig.APP_PHYS_DIR,
J2EEUtils.GetApplicationPhysicalPath(config.getServletContext ()));
servletDomain.SetData(IAppDomainConfig.WEB_APP_DIR, rootPath);
//Set DataDirectory substitution string
(http://blogs.msdn.com/dataaccess/archive/2005/10/28/486273.aspx)
- string dataDirectory =
J2EEUtils.GetInitParameterByHierarchy(config, "DataDirectory");
+ string dataDirectory = config.getServletContext
().getInitParameter ("DataDirectory");
if (dataDirectory == null)
dataDirectory = "App_Data";
@@ -265,49 +233,12 @@
if (webApp_baseDir == null || webApp_baseDir ==
"")
webApp_baseDir = rootPath;
servletDomain.SetData(IAppDomainConfig.APP_BASE_DIR , webApp_baseDir);
-#if DEBUG
- Console.WriteLine("Initialization of webapp " +
webApp_baseDir);
-#endif
- // Mordechai : setting the web app deserializer
object.
-
servletDomain.SetData(J2EEConsts.DESERIALIZER_CONST , this.GetDeserializer());
- servletDomain.SetData([EMAIL PROTECTED],
this.getDriverUtils());
+ Debug.WriteLine("Initialization of webapp " +
webApp_baseDir);
//servletDomain.SetData(".hostingVirtualPath",
"/");
//servletDomain.SetData(".hostingInstallDir",
"/");
return servletDomain;
}
-
- virtual protected [EMAIL PROTECTED] GetDeserializer()
- {
- if (m_deseializer == null)
- m_deseializer = new GHWebDeseserializer();
- return m_deseializer;
- }
-
- protected [EMAIL PROTECTED] m_deseializer = null;
- /// Mordechai: This class comes to solve a problem in class
deserialize
- /// within web application. The problem is that the classloader
that created
- /// some user web class (for example aspx page) is not the
class loader
- /// that de-serialize it - thus we end with
ClassDefNotFoundException.
- /// To prevent this situation we delegate the serialization
back the the
- /// web app (which has the correct class loader...)
- ///
-
- virtual protected [EMAIL PROTECTED] getDriverUtils()
- {
- //by default no driver utils, the specific servlet will
override this method
- return null;
- }
}
-
- class GHWebDeseserializer : [EMAIL PROTECTED]
- {
-
- Object [EMAIL PROTECTED](java.io.ObjectInputStream
stream)
- {
- object obj = stream.readObject();
- return obj;
- }
- }
}
namespace System.Web.GH
@@ -331,3 +262,47 @@
}
}
+
+public class GhDynamicHttpServlet : System.Web.GH.BaseHttpServlet
+{
+}
+
+public class GhStaticHttpServlet : System.Web.GH.BaseStaticHttpServlet
+{
+}
+
+public class GhHttpServlet : System.Web.GH.BaseHttpServlet
+{
+ GhStaticHttpServlet staticServlet;
+
+ public GhHttpServlet () {
+ staticServlet = new GhStaticHttpServlet ();
+ }
+
+ override public void init (ServletConfig config) {
+ base.init (config);
+ staticServlet.init (config);
+ }
+
+ override protected void service (HttpServletRequest req,
HttpServletResponse resp) {
+ 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 ();
+ if (pathInfo.EndsWith (".aspx") ||
+ pathInfo.EndsWith (".asmx") ||
+ pathInfo.EndsWith (".invoke")) {
+ base.service (req, resp);
+ }
+ else {
+ staticServlet.service (req, resp);
+ }
+ }
+
+ override public void destroy () {
+ staticServlet.destroy ();
+ base.destroy ();
+ }
+}
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseStaticHttpServlet.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseStaticHttpServlet.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/BaseStaticHttpServlet.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -32,6 +32,7 @@
using javax.servlet;
using javax.servlet.http;
using vmw.common;
+using System.Diagnostics;
namespace Mainsoft.Web.Hosting
{
@@ -47,7 +48,7 @@
override public void init(ServletConfig config)
{
base.init(config);
- AppDir = J2EEUtils.GetInitParameterByHierarchy(config,
IAppDomainConfig.APP_DIR_NAME);
+ AppDir = config.getServletContext ().getInitParameter
(IAppDomainConfig.APP_DIR_NAME);
if (AppDir != null) {
AppDir = AppDir.Replace('\\', '/');
if (AppDir[AppDir.Length - 1] != '/')
@@ -106,7 +107,7 @@
}
catch(Exception e)
{
- Console.WriteLine("ERROR in Static File Reading
{0},{1}",e.GetType(), e.Message);
+ Trace.WriteLine (String.Format ("ERROR in
Static File Reading {0},{1}", e.GetType (), e.Message));
resp.setStatus(500);
HttpException myExp = new HttpException
("Exception in Reading static file", e);
hos.print(((HttpException)
myExp).GetHtmlErrorMessage ());
@@ -143,7 +144,7 @@
}
catch(Exception e)
{
- Console.WriteLine("ERROR in Static File Reading
{0},{1}",e.GetType(), e.Message);
+ Trace.WriteLine (String.Format ("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 ());
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/OutputStreamWrapper.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/OutputStreamWrapper.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/OutputStreamWrapper.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -41,7 +41,7 @@
/// <summary>
///
/// </summary>
- internal sealed class OutputStreamWrapper : java.io.Writer
+ public sealed class OutputStreamWrapper : java.io.Writer
{
enum OutputMode
{
@@ -53,9 +53,9 @@
readonly OutputStream _outputStream;
readonly OutputMode _outputMode;
- private byte [] _bytebuffer = new byte [1024];
- private char [] _charBuffer = new char [1024];
- sbyte [] _oneByte = new sbyte [1];
+ private byte [] _bytebuffer;
+ private char [] _charBuffer;
+ //sbyte [] _oneByte = new sbyte [1];
Encoding _encoding = null;
@@ -144,12 +144,15 @@
private char [] GetCharBuffer (int length)
{
// We will reuse the buffer if its size is < 32K
- if (_charBuffer.Length >= length)
+ if (_charBuffer != null && _charBuffer.Length >= length)
return _charBuffer;
if (length > 32 * 1024)
return new char [length];
+ if (length < 1024)
+ length = 1024;
+
_charBuffer = new char [length];
return _charBuffer;
}
@@ -157,12 +160,15 @@
private byte [] GetByteBuffer (int length)
{
// We will reuse the buffer if its size is < 32K
- if (_bytebuffer.Length >= length)
+ if (_bytebuffer != null && _bytebuffer.Length >= length)
return _bytebuffer;
if (length > 32 * 1024)
return new byte [length];
+ if (length < 1024)
+ length = 1024;
+
_bytebuffer = new byte [length];
return _bytebuffer;
}
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesContext.cs (from
rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesContext.cs)
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandler.cs
(from rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandler.cs)
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandlerFactory.cs
(from rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandlerFactory.cs)
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesStateManager.cs
(from rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesStateManager.cs)
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesViewHandler.cs
(from rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesViewHandler.cs)
Copied:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.cs (from
rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.cs)
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -38,16 +38,15 @@
using vmw.common;
using [EMAIL PROTECTED];
using InputStream=java.io.InputStream;
+using java.security;
namespace Mainsoft.Web.Hosting {
[MonoTODO("Implement security demands on the path usage functions (and
review)")]
[ComVisible (false)]
- internal sealed class ServletWorkerRequest : HttpWorkerRequest,
IServiceProvider {
- readonly HttpServlet _HttpServlet;
- readonly HttpServletRequest _HttpServletRequest;
- readonly HttpServletResponse _HttpServletResponse;
+ public abstract class BaseWorkerRequest : HttpWorkerRequest,
IServiceProvider {
OutputStreamWrapper _OutputStream;
+ readonly string _contextPath;
readonly string _requestUri;
readonly string _pathInfo;
@@ -79,7 +78,7 @@
static readonly Hashtable KnownServerVariableMap;
- static ServletWorkerRequest() {
+ static BaseWorkerRequest() {
_srvVarsToHeaderMap = new StringDictionary();
_srvVarsToHeaderMap.Add("HTTP_ACCEPT", "Accept");
_srvVarsToHeaderMap.Add("HTTP_REFERER", "Referer");
@@ -96,17 +95,14 @@
KnownServerVariableMap[knownServerVariableNames[i]] = (KnownServerVariable)i;
}
- public ServletWorkerRequest (HttpServlet servlet,
HttpServletRequest req, HttpServletResponse resp, bool alwaysUsePrintWriter) {
- _HttpServlet = servlet;
- _HttpServletRequest = req;
- _HttpServletResponse = resp;
+ public BaseWorkerRequest (string contextPath, string
servletPath, string requestURI) {
- if (alwaysUsePrintWriter)
- _OutputStream = CreateOutputStream (false);
- string contextPath = req.getContextPath();
- string servletPath = req.getServletPath ();
- string requestURI = req.getRequestURI ();
+ _contextPath = contextPath;
+
+ //string contextPath = req.getContextPath();
+ //string servletPath = req.getServletPath ();
+ //string requestURI = req.getRequestURI ();
// servletPath - Returns the part of this request's URL
that calls the servlet.
// so it contains default page.
// requestURI - Returns the part of this request's URL
from the protocol name up to the query string in the first line of the HTTP
request.
@@ -145,37 +141,14 @@
}
}
- public object GetService (Type serviceType)
+ static readonly Type typeOfWriter = typeof (java.io.Writer);
+ public virtual object GetService (Type serviceType)
{
- if (serviceType == typeof(HttpServlet))
- return Servlet;
- if (serviceType == typeof(HttpServletRequest))
- return ServletRequest;
- if (serviceType == typeof(HttpServletResponse))
- return ServletResponse;
- if (serviceType == typeof (java.io.Writer))
+ if (serviceType == typeOfWriter)
return CreateOutputStream (false);
return null;
}
-
- public HttpServlet Servlet {
- get {
- return _HttpServlet;
- }
- }
- public HttpServletRequest ServletRequest {
- get{
- return _HttpServletRequest;
- }
- }
-
- public HttpServletResponse ServletResponse {
- get{
- return _HttpServletResponse;
- }
- }
-
[MonoTODO("Implement security")]
public override string MachineInstallDirectory {
get {
@@ -194,8 +167,11 @@
}
public override void FlushResponse (bool finalFlush) {
- IPortletActionResponse resp =_HttpServletResponse as
IPortletActionResponse;
- if (_OutputStream == null || resp != null &&
resp.isRedirected())
+ //kostat
+ //IPortletActionResponse resp =_HttpServletResponse as
IPortletActionResponse;
+ //if (_OutputStream == null || resp != null &&
resp.isRedirected())
+ // return;
+ if (_OutputStream == null)
return;
_OutputStream.flush();
@@ -204,11 +180,8 @@
}
public override string GetAppPath () {
- return _HttpServletRequest.getContextPath();
+ return _contextPath;
}
- public override string GetAppPathTranslated () {
- return
J2EEUtils.GetApplicationRealPath(_HttpServlet.getServletConfig());;
- }
public override string GetFilePath () {
string uri = GetUriPath();
@@ -231,31 +204,10 @@
return Path.Combine (GetAppPathTranslated (), page);
}
- public override string GetHttpVerbName () {
- return _HttpServletRequest.getMethod();
- }
-
- public override string GetHttpVersion () {
- return _HttpServletRequest.getProtocol();
- }
-
- public override string GetLocalAddress () {
- return _HttpServletRequest.getLocalAddr();
- }
-
- public override int GetLocalPort () {
- return _HttpServletRequest.getServerPort();
- }
-
public override string GetPathInfo () {
- string pathInfo = _pathInfo != null ? _pathInfo :
_HttpServletRequest.getPathInfo();
- return pathInfo != null ? pathInfo : String.Empty;
- }
+ return _pathInfo;
+ }
- public override string GetQueryString () {
- return _HttpServletRequest.getQueryString();
- }
-
public override string GetRawUrl () {
if (_rawUrl == null) {
StringBuilder builder = new StringBuilder();
@@ -273,26 +225,6 @@
return _rawUrl;
}
- public override string GetRemoteAddress() {
- return _HttpServletRequest.getRemoteAddr();
- }
-
- public override string GetRemoteName() {
- return _HttpServletRequest.getRemoteHost();
- }
-
-
- public override int GetRemotePort() {
- try {
- return _HttpServletRequest.getRemotePort();
- }
- 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;
- }
- }
-
public override string GetServerVariable(string name) {
// FIXME: We need to make a proper mapping between the
standard server
// variables and java equivalent. probably we have to
have a configuration file
@@ -302,31 +234,48 @@
string headerName = _srvVarsToHeaderMap[name];
if (headerName != null)
- return _HttpServletRequest.getHeader(
headerName );
+ return getHeader( headerName );
object knownVariable = KnownServerVariableMap[name];
if (knownVariable != null)
return
GetKnownServerVariable((KnownServerVariable)knownVariable);
- return _HttpServletRequest.getHeader( name );
+ return getHeader( name );
}
+ public abstract string GetAuthType ();
+ protected abstract int getContentLength ();
+ protected abstract string getContentType ();
+ public abstract string GetRemoteUser ();
+ protected abstract int getServerPort ();
+ protected abstract string getHeader (string name);
+ protected abstract java.util.Enumeration getHeaderNames ();
+ protected abstract InputStream getInputStream ();
+ public abstract ServletContext GetContext ();
+ protected abstract OutputStreamWrapper CreateOutputStream (bool
binary);
+
+ public abstract HttpSession GetSession (bool create);
+ public abstract bool IsRequestedSessionIdValid ();
+ public abstract string GetRequestedSessionId ();
+ public abstract bool IsUserInRole (string name);
+ public abstract Principal GetUserPrincipal ();
+
string GetKnownServerVariable(KnownServerVariable index) {
switch (index) {
- case KnownServerVariable.AUTH_TYPE : return
_HttpServletRequest.getAuthType();
- case KnownServerVariable.CONTENT_LENGTH :
return Convert.ToString(_HttpServletRequest.getContentLength());
- case KnownServerVariable.CONTENT_TYPE : return
_HttpServletRequest.getContentType();
+ case KnownServerVariable.AUTH_TYPE : return
GetAuthType();
+ case KnownServerVariable.CONTENT_LENGTH :
return Convert.ToString(getContentLength());
+ case KnownServerVariable.CONTENT_TYPE : return
getContentType();
case KnownServerVariable.QUERY_STRING : return
GetQueryString();
case KnownServerVariable.REMOTE_ADDR : return
GetRemoteAddress();
case KnownServerVariable.REMOTE_HOST : return
GetRemoteName();
- case KnownServerVariable.REMOTE_USER : return
_HttpServletRequest.getRemoteUser();
+ case KnownServerVariable.REMOTE_USER : return
GetRemoteUser();
case KnownServerVariable.REQUEST_METHOD :
return GetHttpVerbName ();
case KnownServerVariable.REQUEST_URI : return
GetUriPath();
case KnownServerVariable.SCRIPT_NAME : return
GetFilePath ();
case KnownServerVariable.SERVER_NAME : return
GetServerName();
- case KnownServerVariable.SERVER_PORT : return
Convert.ToString(_HttpServletRequest.getServerPort());
+ case KnownServerVariable.SERVER_PORT : return
Convert.ToString(getServerPort());
case KnownServerVariable.SERVER_PROTOCOL :
return GetHttpVersion ();
- case KnownServerVariable.SERVER_SOFTWARE :
return Servlet.getServletContext().getServerInfo();
+ case KnownServerVariable.SERVER_SOFTWARE :
return GetContext().getServerInfo();
case KnownServerVariable.PATH_INFO : return
GetPathInfo();
default: throw new
IndexOutOfRangeException("index");
}
@@ -340,11 +289,15 @@
return IntPtr.Zero;
}
+ public override string GetAppPathTranslated () {
+ return J2EEUtils.GetApplicationRealPath (GetContext ());
+ }
+
public override string MapPath (string virtualPath) {
if (virtualPath == null)
throw new ArgumentNullException ("virtualPath");
- ServletConfig config = _HttpServlet.getServletConfig
();
+ ServletContext context = GetContext ();
string contextPath = GetAppPath ();
if ((virtualPath.Length > contextPath.Length &&
virtualPath [contextPath.Length] != '/') ||
@@ -354,11 +307,11 @@
appVirtualPathIndex =
virtualPath.IndexOf ('/', appVirtualPathIndex + 1);
string crossContextPath =
appVirtualPathIndex > 0 ?
virtualPath.Remove
(appVirtualPathIndex) : virtualPath;
- ServletContext context =
config.getServletContext ().getContext (crossContextPath);
- if (context != null) {
+ ServletContext other =
context.getContext (crossContextPath);
+ if (other != null) {
string appVirtualPath =
appVirtualPathIndex > 0 ?
virtualPath.Substring
(appVirtualPathIndex) : String.Empty;
- return context.getRealPath
(appVirtualPath);
+ return other.getRealPath
(appVirtualPath);
}
}
@@ -368,7 +321,7 @@
}
string thisAppVirtualPath = virtualPath.Length >
contextPath.Length ? virtualPath.Substring (contextPath.Length) : String.Empty;
- return J2EEUtils.GetApplicationRealPath (config,
thisAppVirtualPath);
+ return J2EEUtils.GetApplicationRealPath (context,
thisAppVirtualPath);
}
@@ -392,24 +345,25 @@
}
}
- private OutputStreamWrapper CreateOutputStream (bool binary)
- {
- IPortletActionResponse resp = _HttpServletResponse as
IPortletActionResponse;
- if (resp != null)
- return null; // no output stream while
processAction
+ //kostat
+ //private OutputStreamWrapper CreateOutputStream (bool binary)
+ //{
+ // IPortletActionResponse resp = _HttpServletResponse as
IPortletActionResponse;
+ // if (resp != null)
+ // return null; // no output stream while processAction
- if (_OutputStream != null)
- return _OutputStream;
+ // if (_OutputStream != null)
+ // return _OutputStream;
- if (_HttpServletResponse != null) {
- if (binary)
- _OutputStream = new OutputStreamWrapper
(_HttpServletResponse.getOutputStream ());
- else
- _OutputStream = new OutputStreamWrapper
(_HttpServletResponse.getWriter ());
- }
+ // if (_HttpServletResponse != null) {
+ // if (binary)
+ // _OutputStream = new OutputStreamWrapper
(_HttpServletResponse.getOutputStream ());
+ // else
+ // _OutputStream = new OutputStreamWrapper
(_HttpServletResponse.getWriter ());
+ // }
- return _OutputStream;
- }
+ // return _OutputStream;
+ //}
public override void SendResponseFromMemory (byte [] data, int
length) {
_OutputStream = CreateOutputStream (true);
@@ -421,26 +375,6 @@
_OutputStream.write(sdata, 0 , length);
}
- public override void SendStatus(int statusCode, string
statusDescription) {
- // setStatus(int, string) is deprecated
- _HttpServletResponse.setStatus(statusCode/*,
statusDescription*/);
- }
-
- public override void SendUnknownResponseHeader(string name,
string value) {
- if (HeadersSent ())
- return;
-
- _HttpServletResponse.addHeader(name, value);
- }
-
- public override bool HeadersSent () {
- return _HttpServletResponse.isCommitted();
- }
-
- public override void SendCalculatedContentLength (int
contentLength) {
- _HttpServletResponse.setContentLength(contentLength);
- }
-
public override void SendKnownResponseHeader (int index, string
value) {
SendUnknownResponseHeader (GetKnownResponseHeaderName
(index), value);
}
@@ -450,18 +384,18 @@
}
public override string GetUnknownRequestHeader (string name) {
- return _HttpServletRequest.getHeader(name);
+ return getHeader(name);
}
public override string [][] GetUnknownRequestHeaders () {
if (unknownHeaders == null) {
ArrayList pairs = new ArrayList ();
- for (java.util.Enumeration he =
_HttpServletRequest.getHeaderNames(); he.hasMoreElements() ;) {
+ for (java.util.Enumeration he =
getHeaderNames(); he.hasMoreElements() ;) {
string key = (string) he.nextElement();
int index =
HttpWorkerRequest.GetKnownRequestHeaderIndex (key);
if (index != -1)
continue;
- pairs.Add (new string [] {key,
_HttpServletRequest.getHeader(key)});
+ pairs.Add (new string [] {key,
getHeader(key)});
}
if (pairs.Count != 0) {
@@ -479,29 +413,17 @@
if (buffer == null || size == 0)
return 0;
sbyte [] sbuffer =
vmw.common.TypeUtils.ToSByteArray(buffer);
- InputStream inp = _HttpServletRequest.getInputStream();
- if (inp == null && _HttpServletRequest is
IPortletActionRequest)
- inp = ((IPortletActionRequest)
_HttpServletRequest).getPortletInputStream();
- int r = (inp != null) ? inp.read(sbuffer, 0, size) : -1;
- return r == -1 ? 0 : r;
+ InputStream inp = getInputStream();
+ if (inp == null)
+ return 0;
+ int r = inp.read (sbuffer, 0, size);
+ return r < 0 ? 0 : r;
}
public override void
SetEndOfSendNotification(System.Web.HttpWorkerRequest.EndOfSendNotification
callback, object extraData) {
_endOfSendCallback = callback;
_endOfSendArgs = extraData;
}
-
- public override string GetProtocol() {
- return _HttpServletRequest.getScheme();
- }
-
- public override string GetServerName() {
- return _HttpServletRequest.getServerName();
- }
-
- public override bool IsSecure() {
- return _HttpServletRequest.isSecure();
- }
}
}
Copied: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/SessionWrapper.cs
(from rev 91824,
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/SessionWrapper.cs)
Modified: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.csproj
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.csproj 2007-12-23
10:43:31 UTC (rev 91824)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.csproj 2007-12-23
12:08:33 UTC (rev 91825)
@@ -101,7 +101,7 @@
-->
<ProjectExtensions>
<VisualStudio>
- <UserProperties REFS-RefInfo-javaee="repository:JavaEE:tomcat:1.3"
REFS-JarPath-j2ee-helpers="..\lib\J2EE.Helpers.jar"
REFS-JarPath-j2se-helpers="..\lib\J2SE.Helpers.jar"
REFS-JarPath-system-web="..\lib\System.Web.jar"
REFS-JarPath-system-configuration="..\lib\System.Configuration.jar"
REFS-JarPath-system-xml="..\lib\System.Xml.jar"
REFS-JarPath-system-data="..\lib\System.Data.jar"
REFS-JarPath-system="..\lib\System.jar"
REFS-JarPath-mscorlib="..\lib\mscorlib.jar" REFS-JarPath-rt=""
REFS-RefInfo-rt="repository:jre:sun:1.4.2" REFS-JarPath-JavaEE="" />
+ <UserProperties REFS-RefInfo-jsf-api="j2il:"
REFS-JarPath-jsf-api="..\lib\jsf-api.jar" REFS-JarPath-JavaEE=""
REFS-RefInfo-rt="repository:jre:sun:1.4.2" REFS-JarPath-rt=""
REFS-JarPath-mscorlib="..\lib\mscorlib.jar"
REFS-JarPath-system="..\lib\System.jar"
REFS-JarPath-system-data="..\lib\System.Data.jar"
REFS-JarPath-system-xml="..\lib\System.Xml.jar"
REFS-JarPath-system-configuration="..\lib\System.Configuration.jar"
REFS-JarPath-system-web="..\lib\System.Web.jar"
REFS-JarPath-j2se-helpers="..\lib\J2SE.Helpers.jar"
REFS-JarPath-j2ee-helpers="..\lib\J2EE.Helpers.jar"
REFS-RefInfo-javaee="repository:JavaEE:tomcat:1.3" />
</VisualStudio>
</ProjectExtensions>
<ItemGroup>
@@ -114,6 +114,10 @@
<Private>False</Private>
</Reference>
<Reference Include="JavaEE, Version=0.0.0.0, Culture=neutral,
processorArchitecture=MSIL" />
+ <Reference Include="jsf-api, Version=0.0.0.0, Culture=neutral,
processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>Refs\jsf-api.dll</HintPath>
+ </Reference>
<Reference Include="rt, Version=1.4.2.65535, Culture=neutral,
processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
@@ -122,17 +126,25 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="..\..\build\common\Locale.cs">
- <Link>Locale.cs</Link>
- </Compile>
<Compile Include="..\..\build\common\MonoTODOAttribute.cs">
<Link>MonoTODOAttribute.cs</Link>
</Compile>
+ <Compile Include="Mainsoft.Web.Hosting\BaseFacesPageHandlerFactory.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\AspNetFacesContext.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\BaseFacesStateManager.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\BaseFacesViewHandler.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\ServletFacesContext.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\ServletFacesStateManager.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\ServletFacesViewHandler.cs" />
<Compile Include="Mainsoft.Web.Hosting\BaseHttpServlet.cs" />
<Compile Include="Mainsoft.Web.Hosting\BaseStaticHttpServlet.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\ServletFacesPageHandler.cs" />
<Compile Include="Mainsoft.Web.Hosting\IncludeHelperServlet.cs" />
<Compile Include="Mainsoft.Web.Hosting\OutputStreamWrapper.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\ServletFacesPageHandlerFactory.cs"
/>
+ <Compile Include="Mainsoft.Web.Hosting\ServletWorkerRequest.cs" />
<Compile Include="Mainsoft.Web.Hosting\ServletWorkerRequest.jvm.cs" />
+ <Compile Include="Mainsoft.Web.Hosting\SessionWrapper.cs" />
<Compile Include="Mainsoft.Web.Profile\CloudscapeProfileProvider.cs" />
<Compile Include="Mainsoft.Web.Profile\DerbyProfileHelper.cs" />
<Compile Include="Mainsoft.Web.Profile\DerbyProfileProvider.cs" />
@@ -155,4 +167,11 @@
<Compile Include="Mainsoft.Web\J2EEUtils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference
Include="..\System.Web\System.Web.Phantom\System.Web.Phantom.csproj">
+ <Project>{FBFDAD51-74B6-4660-81C0-9C8B6C8D3B47}</Project>
+ <Name>System.Web.Phantom</Name>
+ <Private>False</Private>
+ </ProjectReference>
+ </ItemGroup>
</Project>
Modified: trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/DerbyDBSchema.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/DerbyDBSchema.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/DerbyDBSchema.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -33,7 +33,8 @@
using System.Data.OleDb;
using System.Collections.Generic;
using System.Text;
-using System.Configuration.Provider;
+using System.Configuration.Provider;
+using System.Diagnostics;
namespace Mainsoft.Web.Security
{
@@ -290,9 +291,7 @@
new OleDbConnection (String.Format
(shuttingConnection, shutUrl)).Open ();
}
catch (Exception ex) {
-#if TRACE
- Console.Write (ex.ToString ());
-#endif
+ Trace.Write (ex.ToString ());
}
}
}
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/ServletAuthenticationModule.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/ServletAuthenticationModule.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.Security/ServletAuthenticationModule.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -31,6 +31,7 @@
using System.Web.Util;
using javax.servlet;
using javax.servlet.http;
+using Mainsoft.Web.Hosting;
namespace Mainsoft.Web.Security
{
@@ -49,32 +50,32 @@
void OnAuthenticateRequest (object sender, EventArgs args) {
HttpApplication app = (HttpApplication) sender;
- HttpServletRequest req = J2EEUtils.GetWorkerRequest
(app.Context).ServletRequest;
- if (req.getRemoteUser () != null)
+ BaseWorkerRequest req = J2EEUtils.GetWorkerRequest
(app.Context);
+ if (req.GetRemoteUser () != null)
app.Context.User = new ServletPrincipal (req);
}
}
public sealed class ServletPrincipal : IPrincipal
{
- readonly HttpServletRequest _request;
+ readonly BaseWorkerRequest _request;
readonly IIdentity _identity;
- public ServletPrincipal (HttpServletRequest req) {
+ internal ServletPrincipal (BaseWorkerRequest req) {
_request = req;
- string authType = req.getAuthType ();
+ string authType = req.GetAuthType ();
if (authType == null)
authType = String.Empty;
- _identity = new GenericIdentity (req.getRemoteUser (),
authType);
+ _identity = new GenericIdentity (req.GetRemoteUser (),
authType);
}
public bool IsInRole (string role) {
- return _request.isUserInRole (role);
+ return _request.IsUserInRole (role);
}
public IIdentity Identity { get { return _identity; } }
- public java.security.Principal Principal { get { return
_request.getUserPrincipal (); } }
+ public java.security.Principal Principal { get { return
_request.GetUserPrincipal (); } }
}
}
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionIDManager.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionIDManager.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionIDManager.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -30,6 +30,7 @@
using System.Web;
using System.Web.SessionState;
using javax.servlet.http;
+using Mainsoft.Web.Hosting;
namespace Mainsoft.Web.SessionState
{
@@ -45,8 +46,8 @@
}
public string GetSessionID (HttpContext context) {
- HttpServletRequest request = J2EEUtils.GetWorkerRequest
(context).ServletRequest;
- return request.isRequestedSessionIdValid () ?
request.getRequestedSessionId () : null;
+ BaseWorkerRequest request = J2EEUtils.GetWorkerRequest
(context);
+ return request.IsRequestedSessionIdValid () ?
request.GetRequestedSessionId () : null;
}
public void Initialize () {
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateItemCollection.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateItemCollection.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateItemCollection.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -34,6 +34,7 @@
using javax.servlet;
using javax.servlet.http;
+using System.Diagnostics;
namespace Mainsoft.Web.SessionState
{
@@ -57,19 +58,15 @@
_staticObjects = new
HttpStaticObjectsCollection ();
if (context != null) {
- ServletConfig config =
J2EEUtils.GetWorkerRequest (context).Servlet.getServletConfig ();
- string sessionPersistance =
J2EEUtils.GetInitParameterByHierarchy(config,
J2EEConsts.Enable_Session_Persistency);
- if (sessionPersistance == null)
- sessionPersistance =
config.getServletContext().getInitParameter
(J2EEConsts.Enable_Session_Persistency);
+ ServletContext servletContext =
J2EEUtils.GetWorkerRequest (context).GetContext ();
+ string sessionPersistance =
servletContext.getInitParameter (J2EEConsts.Enable_Session_Persistency);
if (sessionPersistance != null) {
try {
_needSessionPersistence
= Boolean.Parse (sessionPersistance);
}
catch (Exception) {
_needSessionPersistence
= false;
-#if DEBUG
- Console.WriteLine
("EnableSessionPersistency init param's value is invalid. the value is " +
sessionPersistance);
-#endif
+ Debug.WriteLine
("EnableSessionPersistency init param's value is invalid. the value is " +
sessionPersistance);
}
}
}
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateStoreProvider.cs
===================================================================
---
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateStoreProvider.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/ServletSessionStateStoreProvider.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -146,7 +146,7 @@
}
internal static HttpSession GetSession (HttpContext context,
bool create, bool throwOnError) {
- HttpSession session = J2EEUtils.GetWorkerRequest
(context).ServletRequest.getSession (create);
+ HttpSession session = J2EEUtils.GetWorkerRequest
(context).GetSession (create);
if (session == null && throwOnError)
throw new HttpException ("Session is not
established");
Modified:
trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/SessionListener.cs
===================================================================
--- trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/SessionListener.cs
2007-12-23 10:43:31 UTC (rev 91824)
+++ trunk/mcs/class/Mainsoft.Web/Mainsoft.Web.SessionState/SessionListener.cs
2007-12-23 12:08:33 UTC (rev 91825)
@@ -28,6 +28,7 @@
using System.Reflection;
using javax.servlet.http;
using Mainsoft.Web.Hosting;
+using System.Diagnostics;
namespace Mainsoft.Web.SessionState
{
@@ -54,12 +55,10 @@
SessionStateUtility.RaiseSessionEnd (container,
this, EventArgs.Empty);
}
-#if DEBUG
catch (Exception e) {
- Console.WriteLine (e.Message);
- Console.WriteLine (e.StackTrace);
+ Debug.WriteLine (e.Message);
+ Debug.WriteLine (e.StackTrace);
}
-#endif
finally {
if (setDomain) {
[EMAIL PROTECTED] ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches