Esempio n. 1
0
 protected virtual ServletFacesContext GetFacesContext(FacesContextFactory facesContextFactory,
                                                       ServletContext servletContext,
                                                       ServletRequest servletRequest,
                                                       ServletResponse servletResponse,
                                                       Lifecycle lifecycle,
                                                       HttpContext httpContext,
                                                       string executionFilePath)
 {
     return(ServletFacesContext.GetFacesContext(facesContextFactory, servletContext, servletRequest, servletResponse, lifecycle, httpContext, executionFilePath));
 }
Esempio n. 2
0
		public static ServletFacesContext GetFacesContext (FacesContextFactory facesContextFactory,
																	ServletContext servletContext,
																	ServletRequest servletRequest,
																	ServletResponse servletResponse,
																	Lifecycle lifecycle,
																	HttpContext httpContext,
																	string executionFilePath) {
			FacesContext oldFacesContex = FacesContext.getCurrentInstance ();
			FacesContext wrappedFacesContex = facesContextFactory.getFacesContext (servletContext, servletRequest, servletResponse, lifecycle);
			ExternalContext externalContext = new ServletExternalContext (wrappedFacesContex.getExternalContext (), httpContext, executionFilePath);
			ServletFacesContext context = new ServletFacesContext (wrappedFacesContex, externalContext, httpContext, oldFacesContex);
			return context;
		}
Esempio n. 3
0
        public static ServletFacesContext GetFacesContext(FacesContextFactory facesContextFactory,
                                                          ServletContext servletContext,
                                                          ServletRequest servletRequest,
                                                          ServletResponse servletResponse,
                                                          Lifecycle lifecycle,
                                                          HttpContext httpContext,
                                                          string executionFilePath)
        {
            FacesContext        oldFacesContex     = FacesContext.getCurrentInstance();
            FacesContext        wrappedFacesContex = facesContextFactory.getFacesContext(servletContext, servletRequest, servletResponse, lifecycle);
            ExternalContext     externalContext    = new ServletExternalContext(wrappedFacesContex.getExternalContext(), httpContext, executionFilePath);
            ServletFacesContext context            = new ServletFacesContext(wrappedFacesContex, externalContext, httpContext, oldFacesContex);

            return(context);
        }
Esempio n. 4
0
        public void ProcessRequest(HttpContext context)
        {
            ServletWorkerRequest wr             = (ServletWorkerRequest)((IServiceProvider)context).GetService(typeof(HttpWorkerRequest));
            ServletContext       servletContext = wr.GetContext();
            HttpServletRequest   request        = wr.ServletRequest;
            HttpServletResponse  response       = wr.ServletResponse;

            ServletFacesContext facesContext = GetFacesContext(_facesContextFactory, servletContext, request, response, _lifecycle, context, _executionFilePath);

            try {
                try {
                    try {
                        Trace.WriteLine("FacesPageHandler: before execute");
                        _lifecycle.execute(facesContext);
                        Trace.WriteLine("FacesPageHandler: after execute");
                    }
                    finally {
                        UIViewRoot viewRoot = facesContext.getViewRoot();
                        if (viewRoot != null && viewRoot.getChildCount() > 0)
                        {
                            _page = (Page)viewRoot.getChildren().get(0);
                        }
                    }
                    Trace.WriteLine("FacesPageHandler: before render");
                    SetupResponseWriter(facesContext, response.getContentType(), response.getCharacterEncoding());
                    _lifecycle.render(facesContext);
                    Trace.WriteLine("FacesPageHandler: after render");
                }
                catch (FacesException fex) {
                    Exception inner = fex.InnerException;
                    if (inner != null)
                    {
                        TypeUtils.Throw(inner);
                    }
                    throw;
                }
            }
            finally {
                facesContext.release();
            }
        }