2 Replies Latest reply on Oct 9, 2013 5:08 PM by Seth Wingert

    JBoss 7.2: Flash scoped messages not surviving post-redirect-get when root virtual host specified

    Seth Wingert Newbie

      I'm using JBoss EAP 7.2.0 Final (EAP 6.1) with JSF 2.1.19 and configured my host as a virtual server at the root context.  (Using a non-root context like /myApp, everything works fine).  I'm trying to show FacesContext info messages after a redirect using flash scope.  For some reason I am not consistently getting the Faces message to show up on the second page.  Sometimes it does, sometimes not.  Sometimes it shows up back on the first page.  Any ideas what's wrong?

       

       

      Here is my JSF2 bean:

       

          @ManagedBean

          @RequestScoped

          public class TestBean {

       

       

              public String submit() {

               FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);

               FacesContext.getCurrentInstance().addMessage(null,new FacesMessage("Faces Info Message"));

               return "/second/secondPage?faces-redirect=true";

              }

          }

       

       

      Relevant firstPage.xhtml:

        

          <h:form>

              <h:commandButton value="ClickMe" action="#{testBean.submit()}"/>

          </h:form>

       

       

      Relevant secondPage.xhtml:

       

       

          <h:body>

              <h:messages id="globalMessages" globalOnly="true"/>

              <h:link outcome="/firstPage" value="Back"/>

          </h:body>

       

       

      JBoss standalone.xml:

       

          <subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">

              <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

              <virtual-server name="myApp" enable-welcome-root="false" default-web-module="myApp">

                  <alias name="localhost"/>

              </virtual-server>

          </subsystem>

       

       

      jboss-web.xml packaged with myApp:

       

       

          <jboss-web>

              <context-root>/</context-root>

              <virtual-host>myApp</virtual-host>

          </jboss-web>

       

       

      Please help!  I'm totally stumped on this one.