Author: igorz
Date: 2007-11-19 07:49:28 -0500 (Mon, 19 Nov 2007)
New Revision: 89926

Added:
   
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/AspNetFacesContext.cs
   
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandler.cs
   
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandlerFactory.cs
   
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesStateManager.cs
   
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesViewHandler.cs
Modified:
   branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.csproj
Log:
added ServletFacesPageHandlerFactory

Added: 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/AspNetFacesContext.cs
===================================================================
--- 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/AspNetFacesContext.cs
     2007-11-19 11:43:25 UTC (rev 89925)
+++ 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/AspNetFacesContext.cs
     2007-11-19 12:49:28 UTC (rev 89926)
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using javax.faces.context;
+using System.Web;
+using System.Web.UI;
+
+namespace Mainsoft.Web.Hosting
+{
+       public class AspNetFacesContext : FacesContext
+       {
+               readonly FacesContext _facesContex;
+               readonly HttpContext _httpContext;
+               readonly IHttpHandler _handler;
+
+               public IHttpHandler Handler {
+                       get { return _handler; }
+               }
+
+               public HttpContext Context {
+                       get { return _httpContext; }
+               }
+
+               AspNetFacesContext (FacesContext facesContex, HttpContext 
httpContext, IHttpHandler handler) {
+                       _facesContex = facesContex;
+                       _httpContext = httpContext;
+                       _handler = handler;
+               }
+
+               public static AspNetFacesContext WrapFacesContext (FacesContext 
facesContex, HttpContext httpContext, IHttpHandler page) {
+                       AspNetFacesContext ctx = new AspNetFacesContext 
(facesContex, httpContext, page);
+                       FacesContext.setCurrentInstance (ctx);
+                       return ctx;
+               }
+
+               public override void addMessage (string __p1, 
javax.faces.application.FacesMessage __p2) {
+                       _facesContex.addMessage (__p1, __p2);
+               }
+
+               public override javax.faces.application.Application 
getApplication () {
+                       return _facesContex.getApplication ();
+               }
+
+               public override java.util.Iterator getClientIdsWithMessages () {
+                       return _facesContex.getClientIdsWithMessages ();
+               }
+
+               public override ExternalContext getExternalContext () {
+                       return _facesContex.getExternalContext ();
+               }
+
+               public override javax.faces.application.FacesMessage.Severity 
getMaximumSeverity () {
+                       return _facesContex.getMaximumSeverity ();
+               }
+
+               public override java.util.Iterator getMessages (string __p1) {
+                       return _facesContex.getMessages (__p1);
+               }
+
+               public override java.util.Iterator getMessages () {
+                       return _facesContex.getMessages ();
+               }
+
+               public override javax.faces.render.RenderKit getRenderKit () {
+                       return _facesContex.getRenderKit ();
+               }
+
+               public override bool getRenderResponse () {
+                       return _facesContex.getRenderResponse ();
+               }
+
+               public override bool getResponseComplete () {
+                       return _facesContex.getResponseComplete ();
+               }
+
+               public override ResponseStream getResponseStream () {
+                       return _facesContex.getResponseStream ();
+               }
+
+               public override ResponseWriter getResponseWriter () {
+                       return _facesContex.getResponseWriter ();
+               }
+
+               public override javax.faces.component.UIViewRoot getViewRoot () 
{
+                       return _facesContex.getViewRoot ();
+               }
+
+               public override void release () {
+                       _facesContex.release ();
+               }
+
+               public override void renderResponse () {
+                       _facesContex.renderResponse ();
+               }
+
+               public override void responseComplete () {
+                       _facesContex.responseComplete ();
+               }
+
+               public override void setResponseStream (ResponseStream __p1) {
+                       _facesContex.setResponseStream (__p1);
+               }
+
+               public override void setResponseWriter (ResponseWriter __p1) {
+                       _facesContex.setResponseWriter (__p1);
+               }
+
+               public override void setViewRoot 
(javax.faces.component.UIViewRoot __p1) {
+                       _facesContex.setViewRoot (__p1);
+               }
+       }
+}

Added: 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandler.cs
===================================================================
--- 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandler.cs
        2007-11-19 11:43:25 UTC (rev 89925)
+++ 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandler.cs
        2007-11-19 12:49:28 UTC (rev 89926)
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Web;
+using javax.faces.component;
+using System.Web.UI;
+using javax.faces.context;
+using javax.faces.lifecycle;
+using javax.faces;
+using javax.servlet;
+using javax.faces.webapp;
+using javax.servlet.http;
+
+namespace Mainsoft.Web.Hosting
+{
+       class ServletFacesPageHandler : IHttpHandler
+       {
+               readonly AspNetFacesContext _facesContext;
+               readonly Lifecycle _lifecycle;
+
+               public bool IsReusable {
+                       get { return false; }
+               }
+
+               public ServletFacesPageHandler (AspNetFacesContext 
facesContext, Lifecycle lifecycle) {
+                       _facesContext = facesContext;
+                       _lifecycle = lifecycle;
+               }
+
+               public void ProcessRequest (HttpContext context) {
+                       try {
+                               _lifecycle.execute (_facesContext);
+#if DEBUG
+                               Console.WriteLine ("FacesPageHandler: before 
render");
+#endif
+                               _lifecycle.render (_facesContext);
+#if DEBUG
+                               Console.WriteLine ("FacesPageHandler: after 
render");
+#endif
+                       }
+                       catch (Exception e) {
+                               throw;
+                       }
+                       finally {
+                               _facesContext.release ();
+                       }
+               }
+       }
+}

Added: 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandlerFactory.cs
===================================================================
--- 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandlerFactory.cs
 2007-11-19 11:43:25 UTC (rev 89925)
+++ 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesPageHandlerFactory.cs
 2007-11-19 12:49:28 UTC (rev 89926)
@@ -0,0 +1,64 @@
+using System.Web;
+using System.Web.Compilation;
+using System.Web.UI;
+using javax.faces.component;
+using javax.servlet;
+using javax.faces.context;
+using javax.faces.lifecycle;
+using javax.servlet.http;
+using System;
+using javax.faces.webapp;
+using javax.faces;
+
+namespace Mainsoft.Web.Hosting
+{
+       class ServletFacesPageHandlerFactory : IHttpHandlerFactory
+       {
+               readonly ServletConfig _servletConfig;
+               readonly FacesContextFactory _facesContextFactory;
+               readonly Lifecycle _lifecycle;
+
+               string getLifecycleId () {
+                       String lifecycleId = _servletConfig.getServletContext 
().getInitParameter (FacesServlet.LIFECYCLE_ID_ATTR);
+                       return lifecycleId != null ? lifecycleId : 
LifecycleFactory.DEFAULT_LIFECYCLE;
+               }
+
+               public ServletFacesPageHandlerFactory () {
+
+                       HttpWorkerRequest wr = (HttpWorkerRequest) 
((IServiceProvider) HttpContext.Current).GetService (typeof 
(HttpWorkerRequest));
+                       HttpServlet servlet = (HttpServlet) ((IServiceProvider) 
wr).GetService (typeof (HttpServlet));
+
+                       _servletConfig = servlet.getServletConfig ();
+                       _facesContextFactory = (FacesContextFactory) 
FactoryFinder.getFactory (FactoryFinder.FACES_CONTEXT_FACTORY);
+                       //TODO: null-check for Weblogic, that tries to 
initialize Servlet before ContextListener
+
+                       //Javadoc says: Lifecycle instance is shared across 
multiple simultaneous requests, it must be implemented in a thread-safe manner.
+                       //So we can acquire it here once:
+                       LifecycleFactory lifecycleFactory = (LifecycleFactory) 
FactoryFinder.getFactory (FactoryFinder.LIFECYCLE_FACTORY);
+                       _lifecycle = lifecycleFactory.getLifecycle 
(getLifecycleId ());
+
+               }
+
+               public virtual IHttpHandler GetHandler (HttpContext context, 
string requestType, string url, string path) {
+                       IHttpHandler handler = 
PageParser.GetCompiledPageInstance (url, path, context);
+                       if (!(handler is Page))
+                               return handler;
+
+                       HttpWorkerRequest wr = (HttpWorkerRequest) 
((IServiceProvider) context).GetService (typeof (HttpWorkerRequest));
+                       HttpServletRequest request = (HttpServletRequest) 
((IServiceProvider) wr).GetService (typeof (HttpServletRequest));
+                       HttpServletResponse response = (HttpServletResponse) 
((IServiceProvider) wr).GetService (typeof (HttpServletResponse));
+
+                       FacesContext facesContext
+                                       = _facesContextFactory.getFacesContext 
(_servletConfig.getServletContext (),
+                                                                               
                                   request,
+                                                                               
                                   response,
+                                                                               
                                   _lifecycle);
+
+                       return new ServletFacesPageHandler 
(AspNetFacesContext.WrapFacesContext (facesContext, context, handler), 
_lifecycle);
+               }
+
+               public virtual void ReleaseHandler (IHttpHandler handler) {
+               }
+       }
+}
+

Added: 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesStateManager.cs
===================================================================
--- 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesStateManager.cs
       2007-11-19 11:43:25 UTC (rev 89925)
+++ 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesStateManager.cs
       2007-11-19 12:49:28 UTC (rev 89926)
@@ -0,0 +1,180 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Web.UI;
+
+using javax.faces;
+using javax.faces.application;
+using javax.faces.render;
+using javax.faces.component;
+using javax.faces.context;
+using System.Web.Hosting;
+using System.Web;
+using java.util;
+
+namespace Mainsoft.Web.Hosting
+{
+       public sealed class ServletFacesStateManager : StateManager
+       {
+               static RenderKitFactory RenderKitFactory = (RenderKitFactory) 
FactoryFinder.getFactory (FactoryFinder.RENDER_KIT_FACTORY);
+
+               public override StateManager.SerializedView saveSerializedView 
(FacesContext facesContext) {
+                       Object treeStruct = getTreeStructureToSave 
(facesContext);
+                       Object compStates = getComponentStateToSave 
(facesContext);
+                       SerializedView serializedView = new SerializedView 
(this, treeStruct, compStates);
+
+                       //if (!isSavingStateInClient (facesContext))
+                       //    saveSerializedViewInSession (facesContext, 
facesContext.getViewRoot ().getViewId (), serializedView);
+
+                       return serializedView;
+               }
+
+               static readonly object [] emptyArray = new object [0];
+
+               protected override Object getTreeStructureToSave (FacesContext 
facesContext) {
+                       UIViewRoot viewRoot = facesContext.getViewRoot ();
+                       //kostat ???
+                       //if (((StateHolder) viewRoot).isTransient ()) {
+                       //    return null;
+                       //}
+
+                       Console.WriteLine ("saving root:" + viewRoot.getViewId 
());
+                       return new int [] { 1, 2, 3 };
+
+                       //myfaces save id. What is it for?
+                       // save ViewRoot tree
+                       //return new String [] { viewRoot.GetType().FullName, 
viewRoot.getId () };
+               }
+
+               protected override Object getComponentStateToSave (FacesContext 
facesContext) {
+                       Console.WriteLine ("Entering getComponentStateToSave");
+
+                       UIViewRoot viewRoot = facesContext.getViewRoot ();
+                       if (viewRoot.isTransient ()) {
+                               return null;
+                       }
+
+                       Object serializedComponentStates = 
viewRoot.processSaveState (facesContext);
+                       //Locale is a state attribute of UIViewRoot and need 
not be saved explicitly
+                       Console.WriteLine ("Exiting getComponentStateToSave");
+                       return serializedComponentStates;
+               }
+
+               public override void writeState (FacesContext facesContext,
+                                                                               
StateManager.SerializedView serializedView) {
+                       if (serializedView != null) {
+                               UIViewRoot uiViewRoot = 
facesContext.getViewRoot ();
+                               //save state in response (client-side: full 
state; server-side: sequence)
+                               RenderKit renderKit = 
RenderKitFactory.getRenderKit (facesContext, uiViewRoot.getRenderKitId ());
+                               // not us.
+                               renderKit.getResponseStateManager ().writeState 
(facesContext, serializedView);
+                       }
+               }
+
+               public override UIViewRoot restoreView (FacesContext 
facesContext,
+                                                                               
                                                 String viewId,
+                                                                               
                                                String renderKitId) {
+
+                       UIViewRoot uiViewRoot = restoreTreeStructure 
(facesContext, viewId, renderKitId);
+                       if (uiViewRoot != null) {
+                               uiViewRoot.setViewId (viewId);
+                               restoreComponentState (facesContext, 
uiViewRoot, renderKitId);
+                               String restoredViewId = uiViewRoot.getViewId ();
+                               if (restoredViewId == null || 
!(restoredViewId.Equals (viewId))) {
+                                       return null;
+                               }
+                       }
+                       return uiViewRoot;
+               }
+
+               protected override UIViewRoot restoreTreeStructure 
(FacesContext facesContext,
+                                                                               
                                                                         String 
viewId,
+                                                                               
                                                                         String 
renderKitId) {
+                       Console.WriteLine ("Entering restoreTreeStructure");
+
+                       UIViewRoot uiViewRoot;
+                       if (isSavingStateInClient (facesContext)) {
+                               RenderKit rk = RenderKitFactory.getRenderKit 
(facesContext, renderKitId);
+                               ResponseStateManager responseStateManager = 
rk.getResponseStateManager ();
+                               Object treeStructure = 
responseStateManager.getTreeStructureToRestore (facesContext, viewId);
+                               if (treeStructure == null) {
+                                       Console.WriteLine ("Exiting 
restoreTreeStructure - No tree structure state found in client request");
+                                       return null;
+                               }
+
+                               AspNetFacesContext aspNetFacesContext = 
(AspNetFacesContext) facesContext;
+                               UIComponent page = aspNetFacesContext.Handler 
as UIComponent;
+                               if (page == null)
+                                       return null;
+                               
+                               uiViewRoot = facesContext.getApplication 
().getViewHandler ().createView (facesContext, viewId);
+                               uiViewRoot.getChildren ().add (0, page);
+                       }
+                       else {
+                               throw new NotImplementedException ();
+                       }
+
+                       Console.WriteLine ("Exiting restoreTreeStructure");
+                       return uiViewRoot;
+               }
+
+               protected override void restoreComponentState (FacesContext 
facesContext,
+                                                                               
                  javax.faces.component.UIViewRoot uiViewRoot,
+                                                                               
                  String renderKitId) {
+
+                       Console.WriteLine ("Entering restoreComponentState");
+
+                       Object serializedComponentStates;
+
+                       if (isSavingStateInClient (facesContext)) {
+                               RenderKit renderKit = 
RenderKitFactory.getRenderKit (facesContext, renderKitId);
+                               ResponseStateManager responseStateManager = 
renderKit.getResponseStateManager ();
+                               serializedComponentStates = 
responseStateManager.getComponentStateToRestore (facesContext);
+                       }
+                       else {
+                               throw new NotImplementedException ();
+                       }
+
+                       if (serializedComponentStates == null) {
+                               Console.WriteLine ("No serialized component 
state found!");
+                               uiViewRoot.setViewId (null);
+                               return;
+                       }
+
+                       if (uiViewRoot.getRenderKitId () == null) {
+                               //Just to be sure...
+                               uiViewRoot.setRenderKitId (renderKitId);
+                       }
+
+                       // now ask the view root component to restore its state
+                       uiViewRoot.processRestoreState (facesContext, 
serializedComponentStates);
+
+                       Console.WriteLine ("Exiting restoreComponentState");
+               }
+
+               //readonly object _stateKey = new object ();
+
+
+               //SerializedView getSerializedViewFromServletSession 
(FacesContext facesContext, string viewId) {
+               //    Map sessionMap = facesContext.getExternalContext 
().getSessionMap ();
+               //    System.Collections.Hashtable states = sessionMap.get 
(_stateKey) as System.Collections.Hashtable;
+               //    if (states == null)
+               //        return null;
+
+               //    return states [viewId] as SerializedView;
+               //}
+
+               //void saveSerializedViewInSession (FacesContext context, 
string viewId, SerializedView serializedView) {
+               //    Map sessionMap = context.getExternalContext 
().getSessionMap ();
+
+               //    System.Collections.Hashtable states = sessionMap.get 
(_stateKey) as System.Collections.Hashtable;
+               //    if (states == null) {
+               //        states = new System.Collections.Hashtable ();
+               //        sessionMap.put (_stateKey, states);
+               //    }
+
+               //    states [viewId] = serializedView;
+               //}
+
+       }
+}

Added: 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesViewHandler.cs
===================================================================
--- 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesViewHandler.cs
        2007-11-19 11:43:25 UTC (rev 89925)
+++ 
branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletFacesViewHandler.cs
        2007-11-19 12:49:28 UTC (rev 89926)
@@ -0,0 +1,164 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using javax.faces.application;
+using javax.servlet.http;
+using java.util;
+using javax.faces.context;
+using javax.faces.component;
+using java.lang;
+using javax.faces.render;
+
+namespace Mainsoft.Web.Hosting
+{
+       public class ServletFacesViewHandler : ViewHandler
+       {
+               public static readonly String FORM_STATE_MARKER = 
"<!--@@JSF_FORM_STATE_MARKER@@-->";
+               public static readonly int FORM_STATE_MARKER_LEN = 
FORM_STATE_MARKER.Length;
+
+               public override Locale calculateLocale (FacesContext 
facesContext) {
+                       Iterator locales = facesContext.getExternalContext 
().getRequestLocales ();
+                       while (locales.hasNext ()) {
+                               Locale locale = (Locale) locales.next ();
+                               for (Iterator it = facesContext.getApplication 
().getSupportedLocales (); it.hasNext (); ) {
+                                       Locale supportLocale = (Locale) it.next 
();
+                                       // higher priority to a language match 
over an exact match
+                                       // that occures further down (see Jstl 
Reference 1.0 8.3.1)
+                                       if (locale.getLanguage ().Equals 
(supportLocale.getLanguage ()) &&
+                                               (supportLocale.getCountry () == 
null ||
+                                                       
supportLocale.getCountry ().Length == 0)) {
+                                               return supportLocale;
+                                       }
+                                       else if (supportLocale.Equals (locale)) 
{
+                                               return supportLocale;
+                                       }
+                               }
+                       }
+
+                       Locale defaultLocale = facesContext.getApplication 
().getDefaultLocale ();
+                       return defaultLocale != null ? defaultLocale : 
Locale.getDefault ();
+               }
+
+               public override String calculateRenderKitId (FacesContext 
facesContext) {
+                       String renderKitId = facesContext.getApplication 
().getDefaultRenderKitId ();
+                       return (renderKitId != null) ? renderKitId : 
RenderKitFactory.HTML_BASIC_RENDER_KIT;
+                       //TODO: how to calculate from client?
+               }
+
+               /**
+                */
+               public override UIViewRoot createView (FacesContext 
facesContext, String viewId) {
+                       Application application = facesContext.getApplication 
();
+                       ViewHandler applicationViewHandler = 
application.getViewHandler ();
+
+                       Locale currentLocale = null;
+                       String currentRenderKitId = null;
+                       UIViewRoot uiViewRoot = facesContext.getViewRoot ();
+                       if (uiViewRoot != null) {
+                               //Remember current locale and renderKitId
+                               currentLocale = uiViewRoot.getLocale ();
+                               currentRenderKitId = uiViewRoot.getRenderKitId 
();
+                       }
+
+                       uiViewRoot = (UIViewRoot) application.createComponent 
(UIViewRoot.COMPONENT_TYPE);
+                       //      as of JSF spec page 7-16:
+                       //      "It is the callers responsibility to ensure 
that setViewId() is called
+                       //      on the returned view, passing the same viewId 
value."
+                       //      so we do not set the viewId here
+
+                       //      ok, but the RI does so, so let's do it, too.
+                       uiViewRoot.setViewId (viewId);
+
+                       if (currentLocale != null) {
+                               //set old locale
+                               uiViewRoot.setLocale (currentLocale);
+                       }
+                       else {
+                               //calculate locale
+                               uiViewRoot.setLocale 
(applicationViewHandler.calculateLocale (facesContext));
+                       }
+
+                       if (currentRenderKitId != null) {
+                               //set old renderKit
+                               uiViewRoot.setRenderKitId (currentRenderKitId);
+                       }
+                       else {
+                               //calculate renderKit
+                               uiViewRoot.setRenderKitId 
(applicationViewHandler.calculateRenderKitId (facesContext));
+                       }
+
+                       return uiViewRoot;
+               }
+
+               public override String getActionURL (FacesContext facesContext, 
String viewId) {
+
+                       //if (PortletUtil.isRenderResponse (facesContext)) {
+                       //    RenderResponse response = (RenderResponse) 
facesContext.getExternalContext ().getResponse ();
+                       //    PortletURL url = response.createActionURL ();
+                       //    url.setParameter (MyFacesGenericPortlet.VIEW_ID, 
viewId);
+                       //    return url.toString ();
+                       //}
+
+                       String path = viewId;//                 getViewIdPath 
(facesContext, viewId);
+                       if (path.Length > 0 && path [0] == '/') {
+                               return facesContext.getExternalContext 
().getRequestContextPath () + path;
+                       }
+                       else {
+                               return path;
+                       }
+               }
+
+               public override String getResourceURL (FacesContext 
facesContext, String path) {
+                       if (path.Length > 0 && path [0] == '/') {
+                               return facesContext.getExternalContext 
().getRequestContextPath () + path;
+                       }
+                       else {
+                               return path;
+                       }
+               }
+
+               public override void renderView (FacesContext facesContext, 
UIViewRoot viewToRender) {
+                       if (viewToRender == null) {
+                               throw new ArgumentNullException 
("viewToRender", "viewToRender must not be null");
+                       }
+
+                       AspNetFacesContext aspNetFacesContext = 
(AspNetFacesContext) facesContext;
+                       UIComponent page = aspNetFacesContext.Handler as 
UIComponent;
+                       if (page == null)
+                               return;
+
+                       if (viewToRender.getChildCount () == 0) {
+                               // GET
+                               // ensure uiViewRoot contains the page
+                               viewToRender.getChildren ().add (0, page);
+                               // process GET request
+                               aspNetFacesContext.Handler.ProcessRequest 
(aspNetFacesContext.Context);
+                       }
+                       else
+                               page.encodeChildren (facesContext);
+               }
+
+
+               public override UIViewRoot restoreView (FacesContext 
facesContext, String viewId) {
+                       Application application = facesContext.getApplication 
();
+                       ViewHandler applicationViewHandler = 
application.getViewHandler ();
+                       String renderKitId = 
applicationViewHandler.calculateRenderKitId (facesContext);
+                       UIViewRoot viewRoot = application.getStateManager 
().restoreView (facesContext,
+                                                                               
                                                                        viewId,
+                                                                               
                                                                        
renderKitId);
+                       return viewRoot;
+               }
+
+               /**
+                * Writes a state marker that is replaced later by one or more 
hidden form
+                * inputs.
+                *
+                * @param facesContext
+                * @throws IOException
+                */
+               public override void writeState (FacesContext facesContext) {
+                       facesContext.getResponseWriter ().write 
(FORM_STATE_MARKER);
+               }
+
+       }
+}

Modified: branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.csproj
===================================================================
--- branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.csproj       
2007-11-19 11:43:25 UTC (rev 89925)
+++ branches/mainsoft/JSF/mcs/class/Mainsoft.Web/Mainsoft.Web.J2EE.csproj       
2007-11-19 12:49:28 UTC (rev 89926)
@@ -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="..\lib\rt.jar" 
REFS-JarPath-JavaEE="" />
+      <UserProperties REFS-RefInfo-myfaces-api-1-1-0="j2il:" 
REFS-JarPath-myfaces-api-1-1-0="..\lib\myfaces-api-1.1.0.jar" 
REFS-JarPath-JavaEE="" REFS-JarPath-rt="..\lib\rt.jar" 
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="myfaces-api-1.1.0, Version=0.0.0.0, Culture=neutral, 
processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\lib\myfaces-api-1.1.0.dll</HintPath>
+    </Reference>
     <Reference Include="rt">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\lib\rt.dll</HintPath>
@@ -126,16 +130,18 @@
     <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\AspNetFacesContext.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.jvm.cs" />
     <Compile Include="Mainsoft.Web.Profile\CloudscapeProfileProvider.cs" />
     <Compile Include="Mainsoft.Web.Profile\DerbyProfileHelper.cs" />
@@ -159,4 +165,4 @@
     <Compile Include="Mainsoft.Web\J2EEUtils.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to