2 Replies Latest reply on Aug 23, 2010 2:24 PM by yasudevil

    Blocking concurrent calls

    yasudevil

      Hi everyone,


      In my login page I added a rich:hotkey to submit the login action when the user hits the return button.


      Everything was working OK but now I've added a s:token to my login form to prevent CSRF.


      Everything was working ok but I decided to test what happens when the user hits twice the Return button and for my displeasure the system crashed.


      I've tried to put ignoreDupResponse true, but nothing. I'm wondering if there is a way around this problem or if it's just a wrong usage by my part.



      <a4j:form id="loginForm">
           <a4j:outputPanel ajaxRendered="true">
                <s:token/>
           </a4j:outputPanel>
           <div style="width: 160px">
                Login <h:inputText value="#{credentials.username}" id="login" required="true" />
                Password <h:inputSecret value="#{credentials.password}" id="password" required="true" autocomplete="off"/>
                <br/>
                <br/>
                     <a4j:commandButton ignoreDupResponses="true"
                          styleClass="loginLoginButton"  id="loginButton"
                          action="#{identity.login}" value="#{labels['login.loginButton']}"/>
                     <rich:hotKey selector="#loginForm" 
                          key="return" handler="#{rich:element('loginButton')}.onclick();return false;" />
                     <input type="button" id="closeButton" 
                          class="loginCancelButton" onclick="window.close();" value="#{labels['login.closeButton']}"/>
           </div>
      </a4j:form>
      



        • 1. Re: Blocking concurrent calls
          lvdberg

          Hi,


          You can use the s:defaultaction tag inside the button, This makes the login button trigger whenever you hit the enter. The second part is disabling the button while its processing. This can be solved by using a small modalpanel when the system is processing-






          <a4j:commandButton id="restoreButton" 
               image="../images/16/Redo.png"
               action="#{bean.doSomething"
               reRender="growl,resultTable, pagingPanel "
               eventsQueue="inputQueue" 
                  limitToList="true" 
               ignoreDupResponses="true" 
               requestDelay="500"
               onclick="#{rich:component('waitPanel')}.show();" 
               oncomplete="#{rich:component('waitPanel')}.hide();" />





          And the waitpanel:




          <h:form id="waitForm" >
          <rich:modalPanel id="waitPanel" autosized="true" domElementAttachment="form" >
               <h:graphicImage value="/images/wait30.gif" />
          </rich:modalPanel>
          </h:form>
          



          Hopefully this helps,


          Leo     

          • 2. Re: Blocking concurrent calls
            yasudevil

            Thanks for the reply, it really helped me with another thing but this bug that I'm having is related to this one. I was mistaken saying it was caused by concurrent calls actually the problem was another.


            http://seamframework.org/Community/SeamTokenTagProblemCSRF


            The link above has a fix for the issue that I'm facing right now. There is a code to fix the clientUIDGenerator, after implementing that my form started to work normally.