3 Replies Latest reply on Nov 29, 2012 4:50 AM by Marko Lukša

    IllegalStateException when redirect from preRenderView listener

    Who AMI Newbie

      https://issues.jboss.org/browse/WELD-1037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

       

      Any progress on this? I met the same issue today.

       

      <f:metadata>

           <f:event listener="#{loginRequiredListener.loginRequired}" type="preRenderView"></f:event>

      </f:metadata>

       

       

      public void loginRequired() throws IOException{
              if(loggedInUserInstance.get() == null){
                  HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
                  originalRequest = request.getRequestURI();
                  log.info(originalRequest);
                  facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, null, "login");
      //            facesContext.getExternalContext().redirect("/login.jsf");
              }
          }
      
      

       

      <navigation-rule>

              <navigation-case>

                  <from-outcome>login</from-outcome>

                  <to-view-id>/login.xhtml</to-view-id>

                  <redirect></redirect>

              </navigation-case>

          </navigation-rule>

       

      java.lang.IllegalStateException

          org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:436)

          javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:170)

          org.jboss.weld.servlet.ConversationPropagationFilter$1.sendRedirect(ConversationPropagationFilter.java:83)