Thank you very much Werner. I will report results as finish experiments with this issue.
2010/10/18 Werner Punz <werner.p...@gmail.com> > 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<werner.p...@gmail.com> >> >> 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*<http://www.agost.ru >>>> >* >>>> I >>>> >>>> use redirection to main page >>>> **http://www.agost.ru/to.do*<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: >>>> >>>> <?xml version="1.0" encoding="UTF-8"?> >>>> >>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >>>> >>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> >>>> >>>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h=" >>>> http://java.sun.com/jsf/html"> >>>> >>>> <h:head> >>>> >>>> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> >>>> >>>> <title</title> >>>> >>>> </h:head> >>>> >>>> <h:body> >>>> >>>> #{redirectBean.redirect} >>>> >>>> </h:body> >>>> >>>> </html> >>>> >>>> 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: >>>> >>>> <welcome-file-list> >>>> >>>> <welcome-file>index.do</welcome-file> >>>> >>>> </welcome-file-list> >>>> >>>> <context-param> >>>> >>>> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> >>>> >>>> <param-value>.xhtml</param-value> >>>> >>>> </context-param> >>>> >>>> <servlet-mapping> >>>> >>>> <servlet-name>Faces Servlet</servlet-name> >>>> >>>> <url-pattern>*.do</url-pattern> >>>> >>>> </servlet-mapping> >>>> >>>> >>>> >>>> *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* >>>> >>>> >>>> >>> >>> >> > >