Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 34401 invoked from network); 18 Oct 2010 15:50:33 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Oct 2010 15:50:33 -0000 Received: (qmail 12403 invoked by uid 500); 18 Oct 2010 15:50:32 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 12366 invoked by uid 500); 18 Oct 2010 15:50:32 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 12358 invoked by uid 99); 18 Oct 2010 15:50:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 15:50:32 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gcjmu-myfaces-user@m.gmane.org designates 80.91.229.12 as permitted sender) Received: from [80.91.229.12] (HELO lo.gmane.org) (80.91.229.12) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 15:50:27 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P7ryO-0002JP-NO for users@myfaces.apache.org; Mon, 18 Oct 2010 17:50:04 +0200 Received: from cm129-141.liwest.at ([81.10.129.141]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 18 Oct 2010 17:50:04 +0200 Received: from werner.punz by cm129-141.liwest.at with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 18 Oct 2010 17:50:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: users@myfaces.apache.org From: Werner Punz Subject: Re: Programmatically redirection causes error on GAE. Date: Mon, 18 Oct 2010 17:47:02 +0200 Lines: 323 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cm129-141.liwest.at User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 In-Reply-To: I personally think this is not a bug of MyFaces but rather a bug in the underlying webcontainer which seems to prevent redirects as soon as you render a response. Werner Am 18.10.10 17:08, schrieb Nikolay Rychkov: > Thank you. > I will try. May be to report to JIRA? > > 2010/10/18 Werner Punz > >> Hi this seems to be a jetty or GAE bug if you ask me probably causes by the >> combination of already rendering something and then causing a redirect >> within the rendering (I am not sure if this is even a bug or maybe some >> expected behavior), >> but try following, since it happens during render time (due to the getter) >> try to shift it away from the render time to something in prerender, you can >> use following mechanisms to achieve that >> >> a) a servlet filter which issues the redirect >> b) a phase listern >> c) a system event, for instance a prerender system event >> >> It might resolve this issue. >> >> Werner >> >> Am 17.10.10 18:56, schrieb Nikolay Rychkov: >> >>> *Hello Sirs,* >>> >>> * >>> * >>> >>> *In my experimental project **http://www.agost.ru** >>> I >>> >>> use redirection to main page >>> **http://www.agost.ru/to.do* >>> >>> * .* >>> >>> *I have to do it this way because user should obtain session. I use >>> PrimeFaces to ajax login that does not work without session. * >>> >>> * >>> * >>> >>> *Sources:* >>> >>> Index.xhtml: >>> >>> >>> >>> >> >>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> #{redirectBean.redirect} >>> >>> >>> >>> >>> >>> RedirectBean: >>> >>> >>> >>> import javax.faces.bean.ManagedBean; >>> >>> import javax.faces.bean.RequestScoped; >>> >>> import javax.faces.context.FacesContext; >>> >>> import java.io.IOException; >>> >>> @ManagedBean >>> >>> @RequestScoped >>> >>> public class RedirectBean { >>> >>> public String getRedirect(){ >>> >>> try { >>> >>> >>> FacesContext.getCurrentInstance().getExternalContext().redirect("to.do"); >>> >>> >>> >>> } catch (IOException e) { >>> >>> e.printStackTrace(); >>> >>> } >>> >>> return ""; >>> >>> } >>> >>> } >>> >>> Part of web.xml: >>> >>> >>> >>> index.do >>> >>> >>> >>> >>> >>> javax.faces.DEFAULT_SUFFIX >>> >>> .xhtml >>> >>> >>> >>> >>> >>> Faces Servlet >>> >>> *.do >>> >>> >>> >>> >>> >>> *Redirection works, but every time I have this error in log:* >>> >>> * >>> * >>> >>> java.lang.IllegalStateException: STREAM >>> >>> at org.mortbay.jetty.Response.getWriter(Response.java:616) >>> >>> at >>> >>> javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:115) >>> >>> at >>> >>> org.apache.myfaces.context.servlet.ServletExternalContextImpl.getResponseOutputWriter(ServletExternalContextImpl.java:184) >>> >>> at >>> >>> org.apache.myfaces.shared_impl.view.JspViewDeclarationLanguageBase.renderView(JspViewDeclarationLanguageBase.java:154) >>> >>> at >>> >>> org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:263) >>> >>> at >>> >>> org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85) >>> >>> at >>> org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239) >>> >>> at >>> javax.faces.webapp.FacesServlet.service(FacesServlet.java:191) >>> >>> at >>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) >>> >>> at >>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) >>> >>> at >>> >>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) >>> >>> at >>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) >>> >>> at >>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) >>> >>> at >>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) >>> >>> at >>> >>> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70) >>> >>> at >>> org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327) >>> >>> at >>> org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126) >>> >>> at >>> >>> com.google.appengine.tools.development.StaticFileUtils.serveWelcomeFileAsForward(StaticFileUtils.java:80) >>> >>> at >>> >>> com.google.appengine.tools.development.LocalResourceFileServlet.maybeServeWelcomeFile(LocalResourceFileServlet.java:247) >>> >>> at >>> >>> com.google.appengine.tools.development.LocalResourceFileServlet.doGet(LocalResourceFileServlet.java:120) >>> >>> at >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:693) >>> >>> at >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:806) >>> >>> at >>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) >>> >>> at >>> >>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) >>> >>> at >>> >>> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58) >>> >>> at >>> >>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) >>> >>> at >>> >>> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) >>> >>> at >>> >>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) >>> >>> at >>> >>> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122) >>> >>> at >>> >>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) >>> >>> at >>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) >>> >>> at >>> >>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) >>> >>> at >>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) >>> >>> at >>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) >>> >>> at >>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) >>> >>> at >>> >>> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70) >>> >>> at >>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >>> >>> at >>> >>> com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:349) >>> >>> at >>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) >>> >>> at org.mortbay.jetty.Server.handle(Server.java:326) >>> >>> at >>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) >>> >>> at >>> >>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) >>> >>> at >>> org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) >>> >>> at >>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) >>> >>> at >>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) >>> >>> at >>> >>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) >>> >>> at >>> >>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) >>> >>> >>> *Is that a bug or I do something wrong?* >>> >>> *Thanks in advance* >>> >>> >> >> >