title: JSF2 and JBoss: Flash scoped messages not surviving post-redirect-get when root virtual host specified
body: <p>I'm using JBoss EAP 6.1 standalone 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.</p>
  
  <p>Here is my JSF2 bean:</p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  public class TestBean {
  
      public String submit() {
          System.out.println("...adding faces info message....");
          FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true);
          FacesContext.getCurrentInstance().addMessage(null,new FacesMessage("Faces Info Message"));
          return "/second/secondPage?faces-redirect=true";
      }
  }
  </code></pre>
  
  <p>Relevant firstPage.xhtml:</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;h:commandButton value="ClickMe" action="#{testBean.submit()}"/&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>Relevant secondPage.xhtml:</p>
  
  <pre><code>&lt;h:body&gt;
      &lt;h:messages id="globalMessages" globalOnly="true"/&gt;
      &lt;h:link outcome="/firstPage" value="Back"/&gt;
  &lt;/h:body&gt;
  </code></pre>
  
  <p>JBoss standalone.xml:</p>
  
  <pre><code>&lt;subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="myApp" native="false"&gt;
      &lt;connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/&gt;
      &lt;virtual-server name="myApp" enable-welcome-root="false" default-web-module="myApp"&gt;
          &lt;alias name="localhost"/&gt;
      &lt;/virtual-server&gt;
  &lt;/subsystem&gt;
  </code></pre>
  
  <p>jboss-web.xml packaged with myApp:</p>
  
  <pre><code>&lt;jboss-web&gt;
      &lt;context-root&gt;/&lt;/context-root&gt;
      &lt;virtual-host&gt;myApp&lt;/virtual-host&gt;
  &lt;/jboss-web&gt;
  </code></pre>
  
  <p>Please help!  I'm totally stumped on this one.</p>