enhanced JSF implementation
authorIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Thu, 29 Nov 2007 16:00:49 +0000 (16:00 -0000)
committerIgor Zelmanovich <igorz@mono-cvs.ximian.com>
Thu, 29 Nov 2007 16:00:49 +0000 (16:00 -0000)
svn path=/branches/mainsoft/JSF/mcs/; revision=90439

mcs/class/System.Web/System.Web.UI/Control.jsf.cs
mcs/class/System.Web/System.Web.UI/Control.jvm.cs
mcs/class/System.Web/System.Web.UI/Page.cs
mcs/class/System.Web/System.Web.UI/Page.jsf.cs
mcs/class/System.Web/System.Web.UI/Page.jvm.cs
mcs/class/System.Web/System.Web/HttpApplication.cs
mcs/class/System.Web/System.Web/HttpContext.jvm.cs
mcs/class/System.Web/System.Web/HttpException.cs
mcs/class/System.Web/System.Web/HttpRequest.cs
mcs/class/System.Web/System.Web/HttpRequest.jvm.cs

index cca7036aeb9adbca120ff422db7ef8d85e2af4f1..a46c247bc3680bcc2840162a8d118f748bcd6c24 100644 (file)
@@ -37,138 +37,195 @@ using javax.faces.context;
 \r
 namespace System.Web.UI\r
 {\r
-       public partial class Control : UIComponentBase\r
+       public partial class Control : UIComponent, StateHolder\r
        {\r
+               ComponentChildrenList _childrenList;\r
 \r
-               #region Forward to base\r
+               protected override void addFacesListener (FacesListener __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
+\r
+               public override void broadcast (FacesEvent __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
+\r
+               public override void decode (FacesContext context) {\r
+                       // do nothing\r
+               }\r
+\r
+               public override void encodeBegin (FacesContext __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
+\r
+               public override void encodeChildren (FacesContext __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
+\r
+               public override void encodeEnd (FacesContext __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
+\r
+               public override UIComponent findComponent (string __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
 \r
                public override Map getAttributes () {\r
-                       return base.getAttributes ();\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               public override ValueBinding getValueBinding (string name) {\r
-                       return base.getValueBinding (name);\r
+               public override int getChildCount () {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               public override void setValueBinding (string name, ValueBinding binding) {\r
-                       base.setValueBinding (name, binding);\r
+               public override List getChildren () {\r
+                       if (_childrenList == null)\r
+                               _childrenList = new ComponentChildrenList (this);\r
+                       return _childrenList;\r
+               }\r
+\r
+               public override string getClientId (FacesContext __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
+\r
+               protected override FacesContext getFacesContext () {\r
+                       return FacesContext.getCurrentInstance ();\r
+               }\r
+\r
+               protected override FacesListener [] getFacesListeners (java.lang.Class __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
+\r
+               public override UIComponent getFacet (string __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
                public override Map getFacets () {\r
-                       return base.getFacets ();\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               public override UIComponent getFacet (string name) {\r
-                       return base.getFacet (name);\r
+               public override Iterator getFacetsAndChildren () {\r
+                       // TODO: consider facets.\r
+                       return getChildren ().iterator ();\r
                }\r
 \r
-               public override void broadcast (FacesEvent @event) {\r
-                       base.broadcast (@event);\r
+               public override string getFamily () {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               [MonoTODO ("is this correct")]\r
-               public override void decode (FacesContext context) {\r
-                       base.decode (context);\r
+               public override string getId () {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               [MonoTODO ("should integrate this")]\r
-               public override void encodeBegin (FacesContext context) {\r
-                       base.encodeBegin (context);\r
+               public override UIComponent getParent () {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               [MonoTODO ("should integrate this")]\r
-               public override void encodeEnd (FacesContext context) {\r
-                       base.encodeEnd (context);\r
+               protected override javax.faces.render.Renderer getRenderer (FacesContext __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               [MonoTODO ("should integrate this")]\r
-               public override object saveState (FacesContext context) {\r
-                       return base.saveState (context);\r
+               public override string getRendererType () {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               [MonoTODO ("should integrate this")]\r
-               public override void restoreState (FacesContext context, object state) {\r
-                       base.restoreState (context, state);\r
+               public override bool getRendersChildren () {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               #endregion\r
+               public override ValueBinding getValueBinding (string name) {\r
+                       return null;\r
+               }\r
 \r
-               //kostat should use set\r
-               public override bool isTransient () {\r
-                       return true;\r
+               public override bool isRendered () {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
+               // TODO: implement\r
+               public override void processDecodes (FacesContext context) {\r
+                       // call processDecodes for all jsf children\r
+               }\r
 \r
+               public override void processRestoreState (FacesContext context, object state) {\r
+                       throw new NotSupportedException ();\r
+               }\r
 \r
-               //public Control () {\r
-               //}\r
+               public override object processSaveState (FacesContext context) {\r
+                       throw new NotSupportedException ();\r
+               }\r
 \r
-               [MonoTODO ("shouldn't be the reverse?")]\r
-               public override string getClientId (FacesContext context) {\r
-                       return ClientID;\r
+               // TODO: implement\r
+               public override void processUpdates (FacesContext context) {\r
+                       // call processUpdates for all jsf children\r
                }\r
 \r
-               [MonoTODO ("shouldn't be the reverse?")]\r
-               public override string getId () {\r
-                       return ID;\r
+               // TODO: implement\r
+               public override void processValidators (FacesContext context) {\r
+                       // call processValidators for all jsf children\r
                }\r
 \r
-               [MonoTODO ("shouldn't be the reverse?")]\r
-               public override void setId (string id) {\r
-                       ID = id;\r
+               public override void queueEvent (FacesEvent __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               [MonoTODO ("shouldn't be the reverse?")]\r
-               public override UIComponent getParent () {\r
-                       //return Parent;\r
-                       return base.getParent ();\r
+               protected override void removeFacesListener (FacesListener __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               [MonoTODO ("shouldn't be the reverse?")]\r
-               public override void setParent (UIComponent parent) {\r
-                       Control p = parent as Control;\r
-                       if (p != null)\r
-                               p.Controls.Add (this);\r
-                       //throw new NotImplementedException("parent is not a Control"); //need to write a wrapper\r
+               public override void setId (string __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
+               }\r
 \r
-                       //Wrong, wrong code!!\r
-                       base.setParent (parent);\r
+               public override void setParent (UIComponent __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               public override bool getRendersChildren () {\r
-                       return true; //see Control.Render\r
+               public override void setRendered (bool __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               public override List getChildren () {\r
-                       //throw new NotImplementedException (); //should actually return Controls collection\r
-                       return base.getChildren ();\r
+               public override void setRendererType (string __p1) {\r
+                       throw new Exception ("The method or operation is not implemented.");\r
                }\r
 \r
-               public override int getChildCount () {\r
-                       //throw new NotImplementedException (); //should actually return Controls.Count\r
-                       return base.getChildCount ();\r
+               public override void setValueBinding (string name, ValueBinding binding) {\r
+                       throw new NotSupportedException ();\r
                }\r
 \r
-               public override UIComponent findComponent (string expr) {\r
-                       return FindControl (expr);\r
+               #region StateHolder Members\r
+\r
+               bool StateHolder.isTransient () {\r
+                       return !EnableViewState;\r
                }\r
 \r
-               public override Iterator getFacetsAndChildren () {\r
-                       //throw new NotImplementedException (); //should actually return Controls collection\r
-                       return base.getFacetsAndChildren ();\r
+               void StateHolder.restoreState (FacesContext context, object state) {\r
+                       LoadViewState (state);\r
                }\r
 \r
-               [MonoTODO ("should integrate this, i.e. reverse call")]\r
-               public override void encodeChildren (FacesContext context) {\r
+               object StateHolder.saveState (FacesContext context) {\r
+                       return SaveViewState ();\r
+               }\r
 \r
-                       RenderControl (new HtmlTextWriter (Context.Response.Output));\r
-                       //throw new NotImplementedException (); //should actually get the writer\r
-                       //context.\r
-                       //base.encodeChildren (context.getResponseWriter);\r
+               void StateHolder.setTransient (bool newTransientValue) {\r
+                       EnableViewState = !newTransientValue;\r
                }\r
 \r
-               public override string getFamily () {\r
-                       return null;\r
+               #endregion\r
+\r
+               class ComponentChildrenList : AbstractList\r
+               {\r
+                       Control _owner;\r
+\r
+                       public ComponentChildrenList (Control owner) {\r
+                               _owner = owner;\r
+                       }\r
+\r
+                       public override object get (int index) {\r
+                               return _owner.Controls [index];\r
+                       }\r
+\r
+                       public override int size () {\r
+                               return _owner.Controls.Count;\r
+                       }\r
                }\r
        }\r
 }\r
index da1fa0741a76d4ef235ff51da2ba9b2dec77265a..509215d7a8823638f06029c530ce2184de32ce19 100644 (file)
@@ -69,5 +69,13 @@ namespace System.Web.UI
                                relativeUrl = Page.CreateRenderUrl (relativeUrl);\r
                        return relativeUrl;\r
                }\r
+\r
+               internal bool IsLoaded {\r
+                       get { return (stateMask & LOADED) != 0; }\r
+               }\r
+\r
+               internal bool IsPrerendered {\r
+                       get { return (stateMask & PRERENDERED) != 0; }\r
+               }\r
        }\r
 }\r
index d8350b9b93f564dc37dc7009844f14cc045c89c7..bde5fb4541d4d1f2227a48bcbf62a8a3d43303f3 100644 (file)
@@ -104,6 +104,8 @@ public partial class Page : TemplateControl, IHttpHandler
        ClientScriptManager scriptManager;
        bool allow_load; // true when the Form collection belongs to this page (GetTypeHashCode)
        PageStatePersister page_state_persister;
+       CultureInfo _appCulture;
+       CultureInfo _appUICulture;
 
        // The initial context
        private HttpContext _context;
@@ -710,7 +712,7 @@ public partial class Page : TemplateControl, IHttpHandler
                CultureInfo ret = null;
                if (culture.StartsWith ("auto", StringComparison.InvariantCultureIgnoreCase)) {
 #if TARGET_J2EE
-                       if (Context.IsPortletRequest)
+                       //if (Context.IsPortletRequest)
                                return deflt;
 #endif
                        string[] languages = Request.UserLanguages;
@@ -765,10 +767,6 @@ public partial class Page : TemplateControl, IHttpHandler
                NameValueCollection coll = null;
                if (0 == String.Compare (Request.HttpMethod, "POST", true, CultureInfo.InvariantCulture))
                        coll = req.Form;
-#if TARGET_J2EE
-               else if (IsPortletRender && req.Form ["__VIEWSTATE"] != null)
-                       coll = req.Form;
-#endif
                else
                        coll = req.QueryString;
 
@@ -779,10 +777,10 @@ public partial class Page : TemplateControl, IHttpHandler
                else
                        allow_load = (c.ID == GetTypeHashCode ());
 
-#if TARGET_J2EE
-               if (Context.IsActionRequest)
-                       return coll;
-#endif
+//#if TARGET_J2EE
+//        if (Context.IsActionRequest)
+//            return coll;
+//#endif
 
                if (coll != null && coll ["__VIEWSTATE"] == null && coll ["__EVENTTARGET"] == null)
                        return null;
@@ -1043,10 +1041,15 @@ public partial class Page : TemplateControl, IHttpHandler
                if (handleViewState)
 #if TARGET_J2EE
                        if (getFacesContext () != null) {
-                               javax.faces.application.StateManager manager = getFacesContext ().getApplication ().getStateManager ();
-                               manager.writeState (getFacesContext (), _facesSerializedView);
+                               javax.faces.application.ViewHandler viewHandler = getFacesContext ().getApplication ().getViewHandler ();
+                               javax.faces.context.ResponseWriter oldFacesWriter = SetupResponseWriter (writer);
+                               try {
+                                       viewHandler.writeState (getFacesContext ());
+                               }
+                               finally {
+                                       getFacesContext ().setResponseWriter (oldFacesWriter);
+                               }
                        }
-                       else
 #endif
                        scriptManager.RegisterHiddenField ("__VIEWSTATE", _savedViewState);
 
@@ -1180,19 +1183,42 @@ public partial class Page : TemplateControl, IHttpHandler
                //-- Control execution lifecycle in the docs
 
                // Save culture information because it can be modified in FrameworkInitialize()
-               CultureInfo culture = Thread.CurrentThread.CurrentCulture;
-               CultureInfo uiculture = Thread.CurrentThread.CurrentUICulture;
+               _appCulture = Thread.CurrentThread.CurrentCulture;
+               _appUICulture = Thread.CurrentThread.CurrentUICulture;
                FrameworkInitialize ();
                context.ErrorPage = _errorPage;
 
                try {
                        InternalProcessRequest ();
-               } catch (ThreadAbortException) {
+               }
+#if TARGET_JVM
+               catch (Exception ex) {
+                       HandleException (ex);
+                       throw;
+               }
+#else
+               catch (ThreadAbortException) {
                        // Do nothing, just ignore it by now.
                } catch (Exception e) {
                        ProcessException (e);
                        throw;
-               } finally {
+               }
+               finally {
+                       ProcessUnload ();
+               }
+#endif
+       }
+
+       void ProcessException (Exception ex) {
+               _context.AddError (ex); // OnError might access LastError
+               OnError (EventArgs.Empty);
+               _context.ClearError (ex);
+               // We want to remove that error, as we're rethrowing to stop
+               // further processing.
+               Trace.Warn ("Unhandled Exception", ex.ToString (), ex);
+       }
+
+       void ProcessUnload () {
                        try {
 #if NET_2_0
                                _lifeCycle = PageLifeCycle.Unload;
@@ -1203,21 +1229,14 @@ public partial class Page : TemplateControl, IHttpHandler
                                _lifeCycle = PageLifeCycle.End;
 #endif
                        } catch {}
-                       if (Thread.CurrentThread.CurrentCulture.Equals (culture) == false)
-                               Thread.CurrentThread.CurrentCulture = culture;
+                       if (Thread.CurrentThread.CurrentCulture.Equals (_appCulture) == false)
+                               Thread.CurrentThread.CurrentCulture = _appCulture;
 
-                       if (Thread.CurrentThread.CurrentUICulture.Equals (uiculture) == false)
-                               Thread.CurrentThread.CurrentUICulture = uiculture;
-               }
-       }
-
-       void ProcessException (Exception ex) {
-               _context.AddError (ex); // OnError might access LastError
-               OnError (EventArgs.Empty);
-               _context.ClearError (ex);
-               // We want to remove that error, as we're rethrowing to stop
-               // further processing.
-               Trace.Warn ("Unhandled Exception", ex.ToString (), ex);
+                       if (Thread.CurrentThread.CurrentUICulture.Equals (_appUICulture) == false)
+                               Thread.CurrentThread.CurrentUICulture = _appUICulture;
+                       
+                       _appCulture = null;
+                       _appUICulture = null;
        }
        
 #if NET_2_0
@@ -1339,13 +1358,12 @@ public partial class Page : TemplateControl, IHttpHandler
                renderingForm = false;  
 
 #if TARGET_J2EE
-               //kostat
-               if (Context.IsActionRequest || IsGetBack)
+               if (getFacesContext () != null)
                        return;
 #endif
 
                RestorePageState ();
-               ProcessLoadPage ();
+               ProcessPostData ();
                ProcessRaiseChangedEvents ();
                ProcessRaisePostBackEvents ();
                ProcessLoadComplete ();
@@ -1374,12 +1392,12 @@ public partial class Page : TemplateControl, IHttpHandler
                }
        }
 
-       void ProcessLoadPage () {
+       void ProcessPostData () {
 
 #if NET_2_0
-#if TARGET_J2EE
-               if (!IsGetBack)
-#endif
+//#if TARGET_J2EE
+//        if (!IsGetBack)
+//#endif
                if (IsPostBack || IsCallback) {
 #else
                if (IsPostBack) {
@@ -1389,22 +1407,14 @@ public partial class Page : TemplateControl, IHttpHandler
                        Trace.Write ("aspx.page", "End ProcessPostData");
                }
 
-#if NET_2_0
-               Trace.Write ("aspx.page", "Begin PreLoad");
-               OnPreLoad (EventArgs.Empty);
-               Trace.Write ("aspx.page", "End PreLoad");
-               _lifeCycle = PageLifeCycle.Load;
-#endif
+               ProcessLoad ();
 
-               Trace.Write ("aspx.page", "Begin Load");
-               LoadRecursive ();
-               Trace.Write ("aspx.page", "End Load");
 #if NET_2_0
-#if TARGET_J2EE
-               if (IsGetBack)
-                       RestoreValidatorsState ();
-               else
-#endif
+//#if TARGET_J2EE
+//        if (IsGetBack)
+//            RestoreValidatorsState ();
+//        else
+//#endif
                if (IsPostBack || IsCallback) {
 #else
                if (IsPostBack) {
@@ -1418,12 +1428,25 @@ public partial class Page : TemplateControl, IHttpHandler
                }
        }
 
+       void ProcessLoad () { 
+#if NET_2_0
+               Trace.Write ("aspx.page", "Begin PreLoad");
+               OnPreLoad (EventArgs.Empty);
+               Trace.Write ("aspx.page", "End PreLoad");
+               _lifeCycle = PageLifeCycle.Load;
+#endif
+
+               Trace.Write ("aspx.page", "Begin Load");
+               LoadRecursive ();
+               Trace.Write ("aspx.page", "End Load");
+       }
+
        void ProcessRaiseChangedEvents () {
 
 #if NET_2_0
-#if TARGET_J2EE
-               if (!IsGetBack)
-#endif
+//#if TARGET_J2EE
+//        if (!IsGetBack)
+//#endif
                if (IsPostBack || IsCallback) {
 #else
                if (IsPostBack) {
@@ -1437,9 +1460,9 @@ public partial class Page : TemplateControl, IHttpHandler
        void ProcessRaisePostBackEvents () {
 
 #if NET_2_0
-#if TARGET_J2EE
-               if (!IsGetBack)
-#endif
+//#if TARGET_J2EE
+//        if (!IsGetBack)
+//#endif
                if (IsPostBack || IsCallback) {
 #else
                if (IsPostBack) {
@@ -1494,12 +1517,6 @@ public partial class Page : TemplateControl, IHttpHandler
                Trace.Write ("aspx.page", "Begin SaveStateComplete");
                OnSaveStateComplete (EventArgs.Empty);
                Trace.Write ("aspx.page", "End SaveStateComplete");
-#if TARGET_J2EE
-               if (getFacesContext () != null) {
-                       javax.faces.application.StateManager manager = getFacesContext ().getApplication ().getStateManager ();
-                       _facesSerializedView = manager.saveSerializedView (getFacesContext ());
-               }
-#endif // TARGET_J2EE
 #endif // NET_2_0
        
        }
@@ -1717,8 +1734,6 @@ public partial class Page : TemplateControl, IHttpHandler
 
        internal string RawViewState {
                get {
-                       if (_savedViewState != null)
-                               return _savedViewState;
                        NameValueCollection postdata = _requestValueCollection;
                        string view_state;
                        if (postdata == null || (view_state = postdata ["__VIEWSTATE"]) == null)
@@ -1739,6 +1754,11 @@ public partial class Page : TemplateControl, IHttpHandler
        PageStatePersister PageStatePersister {
                get {
                        if (page_state_persister == null)
+#if TARGET_J2EE
+                               if (getFacesContext () != null)
+                                       return new FacesPageStatePersister (this);
+                               else
+#endif
                                page_state_persister = new HiddenFieldPageStatePersister (this);
                        return page_state_persister;
                }
index a6326533660c3ae8e0af5249dd199cf89454ab6b..43bb5b02b9878206af243913f84c0639a850f4a0 100644 (file)
@@ -3,6 +3,7 @@
 //\r
 // Authors:\r
 //   Igor Zelmanovich (igorz@mainsoft.com)\r
+//   Konstantin Triger (kostat@mainsoft.com)\r
 //\r
 // (C) 2007 Mainsoft Co. (http://www.mainsoft.com)\r
 //\r
@@ -40,11 +41,12 @@ using javax.faces.application;
 using javax.faces.render;\r
 using javax.faces;\r
 using System.IO;\r
-using System.Threading;
+using System.Threading;\r
+using System.Collections.Specialized;\r
 \r
 namespace System.Web.UI\r
 {\r
-       public partial class Page : ActionSource\r
+       public partial class Page\r
        {\r
                private sealed class AspNetResponseWriter : java.io.Writer\r
                {\r
@@ -81,180 +83,122 @@ namespace System.Web.UI
                        }\r
                }\r
 \r
-               static Class StringClass { get { return vmw.common.TypeUtils.ToClass (String.Empty); } }\r
-               //kostat\r
-               // this is what it should be.\r
-               sealed class PostBackEventMethodBinding : MethodBinding\r
-               {\r
-                       readonly IPostBackEventHandler _handler;\r
-\r
-                       public PostBackEventMethodBinding (IPostBackEventHandler handler) {\r
-                               _handler = handler;\r
-                       }\r
-\r
-                       public override object invoke (FacesContext context, object [] pars) {\r
-                               _handler.RaisePostBackEvent ((string) pars [0]);\r
-                               return null;\r
-                       }\r
-\r
-                       public override Class getType (FacesContext context) {\r
-                               return Page.StringClass;\r
-                       }\r
-               }\r
-\r
-               sealed class EventRaiserMethodBinding : MethodBinding\r
-               {\r
-                       readonly Page _handler;\r
-                       static readonly Class StringClass = Class.forName ("java.lang.String");\r
-\r
-                       public EventRaiserMethodBinding (Page handler) {\r
-                               _handler = handler;\r
-                       }\r
-\r
-                       public override object invoke (FacesContext context, object [] pars) {\r
-                               _handler.EnterThread (context);\r
-                               try {\r
-                                       _handler.ProcessRaisePostBackEvents ();\r
-                                       _handler.ProcessLoadComplete ();\r
-                                       //#if NET_2_0\r
-                                       //                    _handler._lifeCycle = PageLifeCycle.LoadComplete;\r
-                                       //                    _handler.OnLoadComplete (EventArgs.Empty);\r
-\r
-                                       //                    if (_handler.IsCallback) {\r
-                                       //                        string result = _handler.ProcessCallbackData ();\r
-                                       //                        HtmlTextWriter callbackOutput = new HtmlTextWriter (_handler._context.Response.Output);\r
-                                       //                        callbackOutput.Write (result);\r
-                                       //                        callbackOutput.Flush ();\r
-                                       //                        return null; // will be redirected!\r
-                                       //                    }\r
-\r
-                                       //                    _handler._lifeCycle = PageLifeCycle.PreRender;\r
-                                       //#endif\r
-                                       //                    _handler.Trace.Write ("aspx.page", "Begin PreRender");\r
-                                       //                    _handler.PreRenderRecursiveInternal ();\r
-                                       //                    _handler.Trace.Write ("aspx.page", "End PreRender");\r
-\r
-                                       //#if NET_2_0\r
-                                       //                    _handler.ExecuteRegisteredAsyncTasks ();\r
-\r
-                                       //                    _handler._lifeCycle = PageLifeCycle.PreRenderComplete;\r
-                                       //                    _handler.OnPreRenderComplete (EventArgs.Empty);\r
-                                       //#endif\r
-\r
-                                       //                    _handler.Trace.Write ("aspx.page", "Begin SaveViewState");\r
-                                       //                    _handler.SavePageViewState ();\r
-                                       //                    _handler.Trace.Write ("aspx.page", "End SaveViewState");\r
-\r
-                                       //#if NET_2_0\r
-                                       //                    _handler._lifeCycle = PageLifeCycle.SaveStateComplete;\r
-                                       //                    _handler.OnSaveStateComplete (EventArgs.Empty);\r
-                                       //#endif // NET_2_0\r
-\r
-                                       //                    javax.faces.application.StateManager manager = _handler.getFacesContext ().getApplication ().getStateManager ();\r
-                                       //                    _handler._facesSerializedView = manager.saveSerializedView (_handler.getFacesContext ());\r
-\r
-                                       //                    if (_handler.Context.IsActionRequest)\r
-                                       //                        manager.writeState (_handler.getFacesContext (), _handler._facesSerializedView);\r
-\r
-                                       //try {\r
-                                       //    _handler.RenderTrace ();\r
-                                       //    _handler.UnloadRecursive (true);\r
-                                       //}\r
-                                       //catch { }\r
-\r
-                                       //return null;\r
-                               }\r
-                               catch (ThreadAbortException) {\r
-                                       context.responseComplete ();\r
-                               }\r
-                               catch (Exception ex) {\r
-                                       _handler.ProcessException (ex);\r
-                                       context.renderResponse ();\r
-                               }\r
-                               finally {\r
-                                       //_handler.Response.Flush ();\r
-                                       _handler.ExitThread (context);\r
-                               }\r
-                               return null;\r
-                       }\r
-\r
-                       public override Class getType (FacesContext context) {\r
-                               return StringClass;\r
-                       }\r
-               }\r
-\r
                MethodBinding _action;\r
                MethodBinding _actionListener;\r
                bool _immediate;\r
+               Pair _state;\r
+               bool [] _validatorsState;\r
 \r
-               public void EnterThread (FacesContext context) {\r
+               void EnterThread (FacesContext context) {\r
                        if (_lifeCycle == PageLifeCycle.Unknown)\r
                                ProcessRequest (HttpContext.Current);\r
                        else\r
                                SetContext (HttpContext.Current);\r
                }\r
 \r
-               public void ExitThread (FacesContext context) {\r
-               }\r
-\r
-               public override bool isTransient () {\r
-                       //kostat\r
-                       return false;\r
+               void ExitThread (FacesContext context) {\r
+                       // TODO\r
+                       //if (context.getResponseComplete ())\r
+                       //    Response.End ();\r
                }\r
 \r
                public override void encodeBegin (FacesContext context) {\r
+                       // do nothing\r
                }\r
 \r
                public override void encodeChildren (FacesContext context) {\r
+#if DEBUG\r
+                       Console.WriteLine ("encodeChildren");\r
+#endif\r
                        EnterThread (context);\r
                        try {\r
-                               Trace.Write ("aspx.page", "Begin Render");\r
-                               RenderPage ();\r
-                               //base.encodeChildren (context);\r
-                               Trace.Write ("aspx.page", "End Render");\r
+                               if (!context.getResponseComplete ()) {\r
+                                       // ensure lifecycle complete.\r
+                                       if (!IsLoaded) {\r
+                                               ProcessLoad ();\r
+                                               RestoreValidatorsState (_validatorsState);\r
+                                       }\r
+                                       if (!IsPrerendered)\r
+                                               ProcessLoadComplete ();\r
+\r
+                                       RenderPage ();\r
+                               }\r
+                       }\r
+                       catch (Exception ex) {\r
+                               if (!(ex is ThreadAbortException))\r
+                                       ProcessException (ex);\r
+                               throw;\r
                        }\r
                        finally {\r
+                               ProcessUnload ();\r
                                ExitThread (context);\r
                        }\r
                }\r
 \r
                public override void encodeEnd (FacesContext context) {\r
+                       // do nothing\r
+               }\r
+\r
+               public override UIComponent getParent () {\r
+                       return null;\r
                }\r
 \r
                public override void setParent (UIComponent parent) {\r
-                       //base.setParent (parent);\r
                        //ignore: parent is root\r
                }\r
 \r
-               public override object saveState (FacesContext context) {\r
-                       //return base.saveState (context);\r
-                       return _savedViewState;\r
+               // TODO: consider validators state\r
+               public override object processSaveState (FacesContext context) {\r
+#if DEBUG\r
+                       Console.WriteLine ("processSaveState");\r
+#endif\r
+                       NameValueCollection hiddenFields;\r
+                       if (ClientScript.hiddenFields != null) {\r
+                               hiddenFields = new NameValueCollection ();\r
+                               foreach (string key in ClientScript.hiddenFields.Keys)\r
+                                       hiddenFields.Add (key, (string) ClientScript.hiddenFields [key] ?? String.Empty);\r
+                       }\r
+                       else\r
+                               hiddenFields = null;\r
+                       return new object [] { _state, hiddenFields, GetValidatorsState () };\r
                }\r
 \r
-               public override void restoreState (FacesContext context, object state) {\r
+               public override void processRestoreState (FacesContext context, object state) {\r
+#if DEBUG\r
+                       Console.WriteLine ("processRestoreState");\r
+#endif\r
                        EnterThread (context);\r
                        try {\r
-                               _savedViewState = state as string;\r
+                               _state = (Pair) ((object []) state) [0];\r
+                               _validatorsState = (bool []) ((object []) state) [2];\r
                                RestorePageState ();\r
                        }\r
+                       catch (Exception ex) {\r
+                               HandleException (ex);\r
+                               throw;\r
+                       }\r
                        finally {\r
                                ExitThread (context);\r
                        }\r
                }\r
 \r
-               public override void decode (FacesContext context) {\r
+               public override void processDecodes (FacesContext context) {\r
+#if DEBUG\r
+                       Console.WriteLine ("processDecodes");\r
+#endif\r
                        EnterThread (context);\r
                        try {\r
-                               //base.decode (context);\r
-                               //Map requestParameterMap = context.getExternalContext ().getRequestParameterMap ();\r
-                               ProcessLoadPage ();\r
+                               ProcessPostData ();\r
 \r
-                               ((ActionSource) this).setAction (new EventRaiserMethodBinding (this));\r
+                               EventRaiserFacesEvent facesEvent = new EventRaiserFacesEvent (this);\r
+                               facesEvent.setPhaseId (PhaseId.INVOKE_APPLICATION);\r
+                               context.getViewRoot ().queueEvent (facesEvent);\r
 \r
-                               ActionEvent action = new ActionEvent (this);\r
-                               action.setPhaseId (PhaseId.INVOKE_APPLICATION);\r
-                               context.getViewRoot ().queueEvent (action);\r
-                               //queueEvent (new ActionEvent (this));\r
+                               base.processDecodes (context);\r
+                       }\r
+                       catch (Exception ex) {\r
+                               HandleException (ex);\r
+                               throw;\r
                        }\r
                        finally {\r
                                ExitThread (context);\r
@@ -262,22 +206,33 @@ namespace System.Web.UI
                }\r
 \r
                public override void processValidators (FacesContext context) {\r
+#if DEBUG\r
                        Console.WriteLine ("processValidators");\r
+#endif\r
                        EnterThread (context);\r
                        try {\r
                                base.processValidators (context);\r
                        }\r
+                       catch (Exception ex) {\r
+                               HandleException (ex);\r
+                               throw;\r
+                       }\r
                        finally {\r
                                ExitThread (context);\r
                        }\r
                }\r
 \r
                public override void processUpdates (FacesContext context) {\r
+#if DEBUG\r
                        Console.WriteLine ("processUpdates");\r
-                       base.processUpdates (context);\r
+#endif\r
                        EnterThread (context);\r
                        try {\r
-                               ProcessRaiseChangedEvents ();\r
+                               base.processUpdates (context);\r
+                       }\r
+                       catch (Exception ex) {\r
+                               HandleException (ex);\r
+                               throw;\r
                        }\r
                        finally {\r
                                ExitThread (context);\r
@@ -285,95 +240,114 @@ namespace System.Web.UI
                }\r
 \r
                public override void broadcast (FacesEvent e) {\r
-                       Console.WriteLine ("broadcast {0},{1},{2}", e.getSource (), e.getComponent (), e.ToString ());\r
-                       //Console.WriteLine (Environment.StackTrace);\r
-                       base.broadcast (e);\r
-\r
-                       if (e is ActionEvent) {\r
-                               FacesContext context = getFacesContext ();\r
-\r
-                               //ActionSource source = (ActionSource) this;\r
-\r
-                               //MethodBinding actionListenerBinding = source.getActionListener ();\r
-                               //if (actionListenerBinding != null) {\r
-                               //try\r
-                               //{\r
-                               //    actionListenerBinding.invoke (context, new Object [] { e });\r
-                               //}\r
-                               //catch (EvaluationException e)\r
-                               //{\r
-                               //    Throwable cause = e.getCause();\r
-                               //    if (cause != null && cause instanceof AbortProcessingException)\r
-                               //    {\r
-                               //        throw (AbortProcessingException)cause;\r
-                               //    }\r
-                               //    else\r
-                               //    {\r
-                               //        throw e;\r
-                               //    }\r
-                               //}\r
-                               //}\r
-\r
-                               ActionListener defaultActionListener\r
-                                       = context.getApplication ().getActionListener ();\r
-                               if (defaultActionListener != null) {\r
-                                       defaultActionListener.processAction ((ActionEvent) e);\r
-                               }\r
+#if DEBUG\r
+                       Console.WriteLine ("broadcast");\r
+#endif\r
+                       if (!(e is EventRaiserFacesEvent))\r
+                               throw new NotSupportedException ("FacesEvent of class " + e.GetType ().Name + " not supported by Page");\r
+\r
+                       FacesContext context = getFacesContext ();\r
+                       try {\r
+                               ProcessRaiseChangedEvents ();\r
+                               ProcessRaisePostBackEvents ();\r
+                               ProcessLoadComplete ();\r
+                       }\r
+                       catch (Exception ex) {\r
+                               HandleException (ex);\r
+                               throw;\r
                        }\r
+                       finally {\r
+                               ExitThread (context);\r
+                       }\r
+               }\r
 \r
+               void HandleException (Exception ex) {\r
+                       Console.WriteLine (ex.ToString ());\r
+                       try {\r
+                               if (!(ex is ThreadAbortException))\r
+                                       ProcessException (ex);\r
+                       }\r
+                       finally {\r
+                               ProcessUnload ();\r
+                       }\r
+               }\r
 \r
+               bool [] GetValidatorsState () {\r
+                       if (is_validated && Validators.Count > 0) {\r
+                               bool [] validatorsState = new bool [Validators.Count];\r
+                               bool isValid = true;\r
+                               for (int i = 0; i < Validators.Count; i++) {\r
+                                       IValidator val = Validators [i];\r
+                                       if (!val.IsValid)\r
+                                               isValid = false;\r
+                                       else\r
+                                               validatorsState [i] = true;\r
+                               }\r
+                               return validatorsState;\r
+                       }\r
+                       return null;\r
                }\r
 \r
-               #region ActionSource Members\r
+               void RestoreValidatorsState (bool [] validatorsState) {\r
+                       if (validatorsState == null)\r
+                               return;\r
 \r
-               void ActionSource.addActionListener (ActionListener listener) {\r
-                       Console.WriteLine ("addActionListener");\r
-                       addFacesListener (listener);\r
+                       is_validated = true;\r
+                       for (int i = 0; i < Math.Min (validatorsState.Length, Validators.Count); i++) {\r
+                               IValidator val = Validators [i];\r
+                               val.IsValid = validatorsState [i];\r
+                       }\r
                }\r
 \r
-               MethodBinding ActionSource.getAction () {\r
-                       Console.WriteLine ("getAction");\r
-                       return _action;\r
-               }\r
+               ResponseWriter SetupResponseWriter (TextWriter httpWriter) { //TODO\r
+                       FacesContext facesContext = getFacesContext ();\r
 \r
-               MethodBinding ActionSource.getActionListener () {\r
-                       Console.WriteLine ("getActionListener");\r
-                       return _actionListener;\r
-               }\r
+                       ResponseWriter oldWriter = facesContext.getResponseWriter ();\r
+                       RenderKitFactory renderFactory = (RenderKitFactory) FactoryFinder.getFactory (FactoryFinder.RENDER_KIT_FACTORY);\r
+                       RenderKit renderKit = renderFactory.getRenderKit (facesContext,\r
+                                                                                                                        facesContext.getViewRoot ().getRenderKitId ());\r
 \r
-               static readonly Class ActionListenerClass = Class.forName ("javax.faces.event.ActionListener");\r
+                       ServletResponse response = (ServletResponse) facesContext.getExternalContext ().getResponse ();\r
 \r
-               ActionListener [] ActionSource.getActionListeners () {\r
-                       Console.WriteLine ("getActionListeners");\r
-                       return (ActionListener []) getFacesListeners (ActionListenerClass);\r
-               }\r
+                       ResponseWriter writer = renderKit.createResponseWriter (new AspNetResponseWriter (httpWriter),\r
+                                                                                                        response.getContentType (), //TODO: is this the correct content type?\r
+                                                                                                        response.getCharacterEncoding ());\r
+                       facesContext.setResponseWriter (writer);\r
 \r
-               bool ActionSource.isImmediate () {\r
-                       Console.WriteLine ("isImmediate");\r
-                       return _immediate;\r
+                       return oldWriter;\r
                }\r
 \r
-               void ActionSource.removeActionListener (ActionListener actionListener) {\r
-                       Console.WriteLine ("removeActionListener");\r
-                       removeFacesListener (actionListener);\r
-               }\r
+               sealed class FacesPageStatePersister : PageStatePersister\r
+               {\r
+                       public FacesPageStatePersister (Page page)\r
+                               : base (page) {\r
+                       }\r
 \r
-               void ActionSource.setAction (MethodBinding action) {\r
-                       Console.WriteLine ("setAction");\r
-                       _action = action;\r
-               }\r
+                       public override void Load () {\r
+                               if (Page._state != null) {\r
+                                       ViewState = Page._state.First;\r
+                                       ControlState = Page._state.Second;\r
+                               }\r
+                       }\r
 \r
-               void ActionSource.setActionListener (MethodBinding actionListener) {\r
-                       Console.WriteLine ("setActionListener");\r
-                       _actionListener = actionListener;\r
+                       public override void Save () {\r
+                               Page._state = new Pair (ViewState, ControlState);\r
+                       }\r
                }\r
 \r
-               void ActionSource.setImmediate (bool immediate) {\r
-                       Console.WriteLine ("setImmediate");\r
-                       _immediate = immediate;\r
-               }\r
+               sealed class EventRaiserFacesEvent : FacesEvent\r
+               {\r
+                       public EventRaiserFacesEvent (Page page)\r
+                               : base (page) {\r
+                       }\r
 \r
-               #endregion\r
+                       public override bool isAppropriateListener (FacesListener __p1) {\r
+                               throw new NotSupportedException ();\r
+                       }\r
 \r
+                       public override void processListener (FacesListener __p1) {\r
+                               throw new NotSupportedException ();\r
+                       }\r
+               }\r
        }\r
 }\r
index 0385bee84e0bed09ef7306d02b3f58e8ac4fec0f..846d690c9f69173484d9c0ccb586cbdddfb705fe 100644 (file)
@@ -44,11 +44,11 @@ namespace System.Web.UI
 {
        public partial class Page
        {\r
-               const string PageNamespaceKey = "__PAGENAMESPACE";
-               const string RenderPageMark = "vmw.render.page=";
-               const string ActionPageMark = "vmw.action.page=";
-               static readonly string NextActionPageKey = PortletInternalUtils.NextActionPage;
-               static readonly string NextRenderPageKey = PortletInternalUtils.NextRenderPage;
+               //const string PageNamespaceKey = "__PAGENAMESPACE";
+               //const string RenderPageMark = "vmw.render.page=";
+               //const string ActionPageMark = "vmw.action.page=";
+               //static readonly string NextActionPageKey = PortletInternalUtils.NextActionPage;
+               //static readonly string NextRenderPageKey = PortletInternalUtils.NextRenderPage;
 
                bool _emptyPortletNamespace = false;
                string _PortletNamespace = null;
@@ -58,10 +58,18 @@ namespace System.Web.UI
 \r
 
                internal string PortletNamespace
-               {
-                       get {
-                               return Context.PortletNamespace;
-                       }
+               {\r
+                       get {\r
+                               if (_PortletNamespace == null) {\r
+\r
+                                       if (getFacesContext () != null) {\r
+                                               _PortletNamespace = getFacesContext ().getExternalContext ().encodeNamespace (String.Empty);\r
+                                       }\r
+\r
+                                       _PortletNamespace = _PortletNamespace ?? String.Empty;\r
+                               }\r
+                               return _PortletNamespace;\r
+                       }\r
                }
 
                internal string theForm {
@@ -93,11 +101,11 @@ namespace System.Web.UI
                        }
                }
 
-               internal bool IsGetBack {
-                       get {
-                               return IsPostBack && Context.IsPortletRequest && !Context.IsActionRequest;
-                       }
-               }
+               //internal bool IsGetBack {
+               //    get {
+               //        return IsPostBack && Context.IsPortletRequest && !Context.IsActionRequest;
+               //    }
+               //}
 
                internal IPortletRenderResponse RenderResponse
                {
@@ -140,91 +148,44 @@ namespace System.Web.UI
                        return PortletInternalUtils.mapPathIfInternal (url, reqUrl.Host, reqUrl.Port, reqUrl.Scheme, appPath, currPage);
                }
 
-               internal bool OnSaveStateCompleteForPortlet ()
-               {
-                       if (PortletNamespace != null) {
-                               ClientScript.RegisterHiddenField (PageNamespaceKey, PortletNamespace);
-                               ClientScript.RegisterHiddenField (NextActionPageKey, "");
-                               ClientScript.RegisterHiddenField (NextRenderPageKey, "");
-                       }
-
-                       IPortletActionResponse resp = Context.ServletResponse as IPortletActionResponse;
-                       IPortletActionRequest req = Context.ServletRequest as IPortletActionRequest;
-                       if (req == null)
-                               return false;
-
-                       // When redirecting don't save the page viewstate and hidden fields
-                       if (resp.isRedirected ())
-                               return true;
-
-                       if (IsPostBack && 0 == String.Compare (Request.HttpMethod, "POST", true, CultureInfo.InvariantCulture)) {
-                               resp.setRenderParameter ("__VIEWSTATE", GetSavedViewState ());
-                               if (ClientScript.hiddenFields != null)
-                                       foreach (string key in ClientScript.hiddenFields.Keys)
-                                               resp.setRenderParameter (key, (string) ClientScript.hiddenFields [key]);
-
-                               if (is_validated && Validators.Count > 0) {
-                                       string validatorsState = GetValidatorsState ();
-#if DEBUG
-                                       Console.WriteLine ("__VALIDATORSSTATE: " + validatorsState);
-#endif
-                                       if (!String.IsNullOrEmpty (validatorsState))
-                                               resp.setRenderParameter ("__VALIDATORSSTATE", validatorsState);
-                               }
-                       }
-
-                       // Stop processing only if we are handling processAction. If we
-                       // are handling a postback from render then fall through.
-                       return req.processActionOnly ();
-               }
-
-               string GetValidatorsState () {
-                       bool [] validatorsState = new bool [Validators.Count];
-                       bool isValid = true;
-                       for (int i = 0; i < Validators.Count; i++) {
-                               IValidator val = Validators [i];
-                               if (!val.IsValid)
-                                       isValid = false;
-                               else
-                                       validatorsState [i] = true;
-                       }
-                       if (isValid)
-                               return null;
-
-                       return GetFormatter ().Serialize (validatorsState);
-               }
-
-               void RestoreValidatorsState () {
-                       string validatorsStateSerialized = Request.Form ["__VALIDATORSSTATE"];
-                       if (String.IsNullOrEmpty (validatorsStateSerialized))
-                               return;
-
-                       is_validated = true;
-                       bool [] validatorsState = (bool []) GetFormatter ().Deserialize (validatorsStateSerialized);
-                       for (int i = 0; i < Math.Min (validatorsState.Length, Validators.Count); i++) {
-                               IValidator val = Validators [i];
-                               val.IsValid = validatorsState [i];
-                       }
-               }
-
-               void SetupResponseWriter (TextWriter httpWriter) {
-                       FacesContext facesContext = getFacesContext ();
-                       if (facesContext == null)
-                               return;
-                       ResponseWriter writer = facesContext.getResponseWriter ();
-                       if (writer == null) {
-                               RenderKitFactory renderFactory = (RenderKitFactory) FactoryFinder.getFactory (FactoryFinder.RENDER_KIT_FACTORY);
-                               RenderKit renderKit = renderFactory.getRenderKit (facesContext,
-                                                                                                                                facesContext.getViewRoot ().getRenderKitId ());
-
-                               ServletResponse response = (ServletResponse) facesContext.getExternalContext ().getResponse ();
-
-                               writer = renderKit.createResponseWriter (new AspNetResponseWriter (httpWriter),
-                                                                                                                response.getContentType (), //TODO: is this the correct content type?
-                                                                                                                response.getCharacterEncoding ());
-                               facesContext.setResponseWriter (writer);
-                       }
-               }
+//        internal bool OnSaveStateCompleteForPortlet ()
+//        {
+//            if (PortletNamespace != null) {
+//                ClientScript.RegisterHiddenField (PageNamespaceKey, PortletNamespace);
+//                ClientScript.RegisterHiddenField (NextActionPageKey, "");
+//                ClientScript.RegisterHiddenField (NextRenderPageKey, "");
+//            }
+
+//            IPortletActionResponse resp = Context.ServletResponse as IPortletActionResponse;
+//            IPortletActionRequest req = Context.ServletRequest as IPortletActionRequest;
+//            if (req == null)
+//                return false;
+
+//            // When redirecting don't save the page viewstate and hidden fields
+//            if (resp.isRedirected ())
+//                return true;
+
+//            if (IsPostBack && 0 == String.Compare (Request.HttpMethod, "POST", true, CultureInfo.InvariantCulture)) {
+//                resp.setRenderParameter ("__VIEWSTATE", GetSavedViewState ());
+//                if (ClientScript.hiddenFields != null)
+//                    foreach (string key in ClientScript.hiddenFields.Keys)
+//                        resp.setRenderParameter (key, (string) ClientScript.hiddenFields [key]);
+
+//                if (is_validated && Validators.Count > 0) {
+//                    string validatorsState = GetValidatorsState ();
+//#if DEBUG
+//                    Console.WriteLine ("__VALIDATORSSTATE: " + validatorsState);
+//#endif
+//                    if (!String.IsNullOrEmpty (validatorsState))
+//                        resp.setRenderParameter ("__VALIDATORSSTATE", validatorsState);
+//                }
+//            }
+
+//            // Stop processing only if we are handling processAction. If we
+//            // are handling a postback from render then fall through.
+//            return req.processActionOnly ();
+//        }\r
+\r
 
                internal string EncodeURL (string raw) {
                        //kostat: BUGBUG: complete
index b3eb4a4c4dbe5c99d9be8042d7da80e91b4b10d2..424ec1739c3f212766c8139b71116ca08ab399aa 100644 (file)
@@ -967,8 +967,8 @@ namespace System.Web {
                                                goto release;
                                
 #if TARGET_J2EE
-                       bool doProcessHandler = false;
                processHandler:
+                       bool doProcessHandler = false;
 #endif
                        try {
                                context.BeginTimeoutPossible ();
index 9805480abf48fe57a2d438ede87e1be2d973e076..e9e47cf7fa9e99639b0fc5ade8c54d7f95973a9b 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Web {
        \r
        public sealed partial class HttpContext {\r
                static readonly LocalDataStoreSlot _ContextSlot = Thread.GetNamedDataSlot ("Context");\r
-               string _PortletNamespace;\r
+               //string _PortletNamespace;\r
                // No remoting support (CallContext) yet in Grasshopper\r
                [MonoInternalNote("Context - Use System.Remoting.Messaging.CallContext instead of Thread storage")]\r
                public static HttpContext Current\r
@@ -76,13 +76,13 @@ namespace System.Web {
                        get { return (HttpServletResponse)GetWorkerService(typeof(HttpServletResponse)); }\r
                }\r
 \r
-               static readonly Type typeOfFacesContext = typeof (FacesContext);\r
-               internal FacesContext FacesContext {\r
-                       get {\r
-                               FacesContext faces = (FacesContext) GetWorkerService (typeOfFacesContext);\r
-                               return faces ?? javax.faces.context.FacesContext.getCurrentInstance ();\r
-                       }\r
-               }\r
+               //static readonly Type typeOfFacesContext = typeof (FacesContext);\r
+               //internal FacesContext FacesContext {\r
+               //    get {\r
+               //        FacesContext faces = (FacesContext) GetWorkerService (typeOfFacesContext);\r
+               //        return faces ?? javax.faces.context.FacesContext.getCurrentInstance ();\r
+               //    }\r
+               //}\r
 \r
                HttpRuntime _httpRuntime = null;\r
                internal HttpRuntime HttpRuntimeInstance {\r
@@ -105,45 +105,44 @@ namespace System.Web {
                        get { return true; }\r
                }\r
 \r
-               internal bool IsActionRequest {\r
-                       get {\r
-                               FacesContext faces = FacesContext;\r
-                               return faces != null && !faces.getRenderResponse ();\r
-                       }\r
-               }\r
-               internal bool IsPortletRequest {\r
-                       get {\r
-                               FacesContext faces = FacesContext;\r
-                               return faces != null && !(faces.getExternalContext ().getContext () is ServletContext);\r
-                       }\r
-               }\r
-\r
-               internal bool IsFacesRequest {\r
-                       get {\r
-                               return FacesContext != null;\r
-                       }\r
-               }\r
-\r
-               internal string PortletNamespace\r
-               {\r
-                       get {\r
-                               if (_PortletNamespace == null) {\r
-                                       FacesContext faces = null;\r
-\r
-                                       //kostat: BUGBUG: complete\r
-                                       //string usePortletNamespace = J2EEUtils.GetInitParameterByHierarchy (Context.Servlet.getServletConfig (), "mainsoft.use.portlet.namespace");\r
-                                       //if (usePortletNamespace == null || Boolean.Parse (usePortletNamespace))\r
-                                               faces = FacesContext;\r
-\r
-                                       if (faces != null) {\r
-                                               _PortletNamespace = faces.getExternalContext ().encodeNamespace (String.Empty);\r
-                                       }\r
+               //internal bool IsActionRequest {\r
+               //    get {\r
+               //        FacesContext faces = FacesContext;\r
+               //        return faces != null && !faces.getRenderResponse ();\r
+               //    }\r
+               //}\r
+               //internal bool IsServletRequest {\r
+               //    get {\r
+               //        return ServletRequest!=null;\r
+               //    }\r
+               //}\r
+\r
+               //internal bool IsFacesRequest {\r
+               //    get {\r
+               //        return FacesContext != null;\r
+               //    }\r
+               //}\r
+\r
+               //internal string PortletNamespace\r
+               //{\r
+               //    get {\r
+               //        if (_PortletNamespace == null) {\r
+               //            FacesContext faces = null;\r
+\r
+               //            //kostat: BUGBUG: complete\r
+               //            //string usePortletNamespace = J2EEUtils.GetInitParameterByHierarchy (Context.Servlet.getServletConfig (), "mainsoft.use.portlet.namespace");\r
+               //            //if (usePortletNamespace == null || Boolean.Parse (usePortletNamespace))\r
+               //                faces = FacesContext;\r
+\r
+               //            if (faces != null) {\r
+               //                _PortletNamespace = faces.getExternalContext ().encodeNamespace (String.Empty);\r
+               //            }\r
                                        \r
-                                       _PortletNamespace = _PortletNamespace ?? String.Empty;\r
-                               }\r
-                               return _PortletNamespace;\r
-                       }\r
-               }\r
+               //            _PortletNamespace = _PortletNamespace ?? String.Empty;\r
+               //        }\r
+               //        return _PortletNamespace;\r
+               //    }\r
+               //}\r
 \r
                internal void BeginTimeoutPossible ()\r
                {\r
index 4293feea7eb86bee438f3f7bf5c69deb421803f6..2e26ec408bbab626d8905ba512a320f509236b1c 100644 (file)
@@ -163,7 +163,7 @@ table.sampleCode {{width: 100%; background-color: #ffffcc; }}
                        WriteFileTop (builder, "Runtime Error");
                        builder.Append (@"<p><strong>Description:</strong> An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons)." + (
 #if TARGET_J2EE //on portal we cannot know if we run locally
-                               HttpContext.Current.IsPortletRequest ? String.Empty :
+                               HttpContext.Current.ServletRequest == null ? String.Empty :
 #endif
                                " It could, however, be viewed by browsers running on the local server machine.") 
                                + @"</p>
index 16e12ff59b22d88a18c10e6de2d172583c427813..30521c6ddf7f04c14aef3156a49cce4920d3c306 100644 (file)
@@ -594,9 +594,9 @@ namespace System.Web {
                                        if (IsContentType ("multipart/form-data", true))
                                                LoadMultiPart ();
                                        else if (
-#if TARGET_J2EE
-                                               Context.IsPortletRequest ||
-#endif
+//#if TARGET_J2EE
+//                        Context.ServletRequest == null ||
+//#endif
                                                IsContentType ("application/x-www-form-urlencoded", true))
                                                LoadWwwForm ();
 
index 804b7bd0ec123e75e4093d9c781f2ae83de0211c..56741c0484efc8b19d47d471b2fea140b2bebb8a 100644 (file)
@@ -71,7 +71,7 @@ namespace System.Web
 \r
                        for (java.util.Enumeration e = servletReq.getParameterNames(); e.hasMoreElements() ;) {\r
                                string key = (string) e.nextElement();\r
-                               string [] qvalue = Context.IsPortletRequest ? null : QueryString.GetValues (key);\r
+                               string [] qvalue = QueryString.GetValues (key);\r
                                string [] qfvalue = servletReq.getParameterValues (key);\r
 \r
                                for (int i = (qvalue != null) ? qvalue.Length : 0; i < qfvalue.Length; i++)\r