Author: igorz
Date: 2007-12-16 07:13:32 -0500 (Sun, 16 Dec 2007)
New Revision: 91376
Modified:
branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Page.cs
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpContext.cs
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpContext.jvm.cs
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpServerUtility.cs
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/IHttpExtendedHandler.cs
branches/mainsoft/JSF/mcs/class/System.Web/System.Web20.csproj
Log:
2007-12-16 Igor Zelmanovich <[EMAIL PROTECTED]>
* HttpContext.cs: added IsProcessingInclude property.
* HttpServerUtility.cs: set IsProcessingInclude value within Execute.
2007-12-16 Igor Zelmanovich <[EMAIL PROTECTED]>
* Page.cs: on CrossPagePostBack previous page is processed by Execute
API,
that allow CurrentHandler property works correctly during Page
processing.
Modified: branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpContext.cs
===================================================================
--- branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpContext.cs
2007-12-16 12:02:20 UTC (rev 91375)
+++ branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpContext.cs
2007-12-16 12:13:32 UTC (rev 91376)
@@ -72,6 +72,7 @@
object config_timeout;
int timeout_possible;
DateTime time_stamp = DateTime.UtcNow;
+ bool _isProcessingInclude;
#if NET_2_0
#if TARGET_JVM
@@ -101,6 +102,11 @@
}
+ internal bool IsProcessingInclude {
+ get { return _isProcessingInclude; }
+ set { _isProcessingInclude = value; }
+ }
+
public Exception [] AllErrors {
get {
if (errors == null)
Modified:
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpContext.jvm.cs
===================================================================
--- branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpContext.jvm.cs
2007-12-16 12:02:20 UTC (rev 91375)
+++ branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpContext.jvm.cs
2007-12-16 12:13:32 UTC (rev 91376)
@@ -38,10 +38,12 @@
using System.Web.UI;
using javax.servlet;
using System.Collections.Specialized;
+using Mainsoft.Web;
namespace System.Web {
- public sealed partial class HttpContext {
+ public sealed partial class HttpContext : IHttpExtendedContext
+ {
static readonly LocalDataStoreSlot _ContextSlot =
Thread.GetNamedDataSlot ("Context");
//string _PortletNamespace;
// No remoting support (CallContext) yet in Grasshopper
@@ -157,5 +159,13 @@
Request.SetWorkerRequest (wr);
Response.SetWorkerRequest (wr);
}
+
+ #region IHttpExtendedContext Members
+
+ bool IHttpExtendedContext.IsProcessingInclude {
+ get { return IsProcessingInclude; }
+ }
+
+ #endregion
}
}
Modified:
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpServerUtility.cs
===================================================================
--- branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpServerUtility.cs
2007-12-16 12:02:20 UTC (rev 91375)
+++ branches/mainsoft/JSF/mcs/class/System.Web/System.Web/HttpServerUtility.cs
2007-12-16 12:13:32 UTC (rev 91376)
@@ -36,9 +36,6 @@
using System.Collections.Specialized;
using System.Security.Permissions;
using System.Text;
-#if TARGET_J2EE
-using Mainsoft.Web;
-#endif
namespace System.Web {
@@ -102,7 +99,7 @@
internal
#endif
void Execute (string path, TextWriter writer, bool preserveForm)
- {
+ {
Execute (path, writer, preserveForm, false);
}
@@ -123,10 +120,10 @@
string exePath = UrlUtils.Combine
(context.Request.BaseVirtualDir, path);
IHttpHandler handler =
context.ApplicationInstance.GetHandler (context, exePath);
- Execute (handler, writer, preserveForm, exePath,
queryString, isTransfer);
+ Execute (handler, writer, preserveForm, exePath,
queryString, isTransfer, true);
}
- void Execute (IHttpHandler handler, TextWriter writer, bool
preserveForm, string exePath, string queryString, bool isTransfer) {
+ internal void Execute (IHttpHandler handler, TextWriter writer,
bool preserveForm, string exePath, string queryString, bool isTransfer, bool
isInclude) {
#if NET_2_0 && !TARGET_J2EE
// If the target handler is not Page, the transfer must
not occur.
// InTransit == true means we're being called from
Transfer
@@ -154,32 +151,17 @@
TextWriter previous = response.SetTextWriter (output);
string oldExePath = request.CurrentExecutionFilePath;
+ bool oldIsInclude = context.IsProcessingInclude;
try {
#if NET_2_0
context.PushHandler (handler);
#endif
request.SetCurrentExePath (exePath);
+ context.IsProcessingInclude = isInclude;
if (!(handler is IHttpAsyncHandler)) {
-#if TARGET_J2EE
- if (!preserveForm && handler is
IHttpExtendedHandler) {
- IHttpExtendedHandler ehandler =
(IHttpExtendedHandler) handler;
- object oldState =
ehandler.GetContextState(context);
- if (oldState != null)
-
ehandler.SetContextState (context, null);
- try {
- handler.ProcessRequest
(context);
- }
- finally {
- if (oldState != null)
-
ehandler.SetContextState (context, oldState);
- }
- }
- else
-#endif
- handler.ProcessRequest
(context);
- }
- else {
+ handler.ProcessRequest (context);
+ } else {
IHttpAsyncHandler asyncHandler =
(IHttpAsyncHandler) handler;
IAsyncResult ar =
asyncHandler.BeginProcessRequest (context, null, null);
ar.AsyncWaitHandle.WaitOne ();
@@ -197,6 +179,7 @@
context.PopHandler ();
#endif
request.SetCurrentExePath (oldExePath);
+ context.IsProcessingInclude = oldIsInclude;
}
}
@@ -250,18 +233,16 @@
// TODO: see the MS doc and search for
"enableViewStateMac": this method is not
// allowed for pages when preserveForm is true and the
page IsCallback property
// is true.
- Execute (handler, null, preserveForm,
context.Request.CurrentExecutionFilePath, null, true);
+ Execute (handler, null, preserveForm,
context.Request.CurrentExecutionFilePath, null, true, true);
context.Response.End ();
}
-#endif
-#if NET_2_0
public void Execute (IHttpHandler handler, TextWriter writer,
bool preserveForm)
{
if (handler == null)
throw new ArgumentNullException ("handler");
- Execute (handler, writer, preserveForm,
context.Request.CurrentExecutionFilePath, null, false);
+ Execute (handler, writer, preserveForm,
context.Request.CurrentExecutionFilePath, null, false, true);
}
public static byte[] UrlTokenDecode (string input)
Modified:
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/IHttpExtendedHandler.cs
===================================================================
---
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/IHttpExtendedHandler.cs
2007-12-16 12:02:20 UTC (rev 91375)
+++
branches/mainsoft/JSF/mcs/class/System.Web/System.Web/IHttpExtendedHandler.cs
2007-12-16 12:13:32 UTC (rev 91376)
@@ -33,7 +33,5 @@
public interface IHttpExtendedHandler : IHttpHandler
{
bool IsCompleted { get;}
- object GetContextState (HttpContext context);
- void SetContextState (HttpContext context, object state);
}
}
Modified: branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Page.cs
===================================================================
--- branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Page.cs
2007-12-16 12:02:20 UTC (rev 91375)
+++ branches/mainsoft/JSF/mcs/class/System.Web/System.Web.UI/Page.cs
2007-12-16 12:13:32 UTC (rev 91376)
@@ -760,14 +760,8 @@
[EditorBrowsable (EditorBrowsableState.Advanced)]
protected virtual NameValueCollection DeterminePostBackMode ()
{
-#if !TARGET_J2EE
- // if request was transfered from other page such Transfer
-#if NET_2_0
- if(!isCrossPagePostBack)
-#endif
- if (this != _context.Handler)
+ if (_context.IsProcessingInclude)
return null;
-#endif
HttpRequest req = Request;
if (req == null)
@@ -789,18 +783,14 @@
if (coll != null && coll ["__VIEWSTATE"] == null && coll
["__EVENTTARGET"] == null)
return null;
#if TARGET_J2EE
- if (this != _context.Handler) {
- if (getFacesContext () != null) {
- // check if it is PreviousPage
- string prevViewId = coll [PreviousPageID];
- if (!String.IsNullOrEmpty (prevViewId)) {
- string appPath =
VirtualPathUtility.RemoveTrailingSlash (Request.ApplicationPath);
- prevViewId = prevViewId.Substring
(appPath.Length);
- isCrossPagePostBack = String.Compare
(prevViewId, getFacesContext ().getExternalContext ().getRequestPathInfo (),
StringComparison.OrdinalIgnoreCase) == 0;
- }
+ if (getFacesContext () != null) {
+ // check if it is PreviousPage
+ string prevViewId = coll [PreviousPageID];
+ if (!String.IsNullOrEmpty (prevViewId)) {
+ string appPath =
VirtualPathUtility.RemoveTrailingSlash (Request.ApplicationPath);
+ prevViewId = prevViewId.Substring
(appPath.Length);
+ isCrossPagePostBack = String.Compare
(prevViewId, getFacesContext ().getExternalContext ().getRequestPathInfo (),
StringComparison.OrdinalIgnoreCase) == 0;
}
- if (!isCrossPagePostBack)
- return null;
}
#endif
return coll;
@@ -2663,7 +2653,7 @@
#if TARGET_J2EE
if (getFacesContext () != null) {
IHttpHandler handler =
Context.ApplicationInstance.GetHandler (Context, prevPage);
- Server.Execute (handler, null, true);
+ Server.Execute (handler, null, true,
_context.Request.CurrentExecutionFilePath, null, false, false);
if (_context.Items.Contains
(CrossPagePostBack)) {
previousPage = (Page)
_context.Items [CrossPagePostBack];
_context.Items.Remove
(CrossPagePostBack);
@@ -2671,9 +2661,10 @@
return;
}
#else
- previousPage = (Page)
PageParser.GetCompiledPageInstance (prevPage, Server.MapPath (prevPage),
Context);
+ IHttpHandler handler =
PageParser.GetCompiledPageInstance (prevPage, Server.MapPath (prevPage),
Context);
+ previousPage = (Page) handler;
previousPage.isCrossPagePostBack = true;
- previousPage.ProcessRequest (Context);
+ Server.Execute (handler, null, true,
_context.Request.CurrentExecutionFilePath, null, false, false);
#endif
}
}
Modified: branches/mainsoft/JSF/mcs/class/System.Web/System.Web20.csproj
===================================================================
--- branches/mainsoft/JSF/mcs/class/System.Web/System.Web20.csproj
2007-12-16 12:02:20 UTC (rev 91375)
+++ branches/mainsoft/JSF/mcs/class/System.Web/System.Web20.csproj
2007-12-16 12:13:32 UTC (rev 91376)
@@ -1233,6 +1233,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="System.Web\HttpWorkerRequest.jvm.cs" />
+ <Compile Include="System.Web\IHttpExtendedContext.cs" />
<Compile Include="System.Web\IHttpExtendedHandler.cs" />
<Compile Include="System.Web\UplevelHelper.cs" />
</ItemGroup>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches