Example #1
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();
            }
        }