3 Replies Latest reply on Feb 19, 2011 8:03 PM by qixunyuan

    Does not conversation work in rpc from gwt?

    yoshiki

      Hi all.


      I want to have seam and conversation in rpc from gwt.
      This is the code of the server-side.


      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Name(gwt2SeamService)
      public class GWT2SeamServiceImpl implements GWT2SeamServiceLocal {


              @Logger
              private Log log;
             
              @PersistenceContext(type = PersistenceContextType.EXTENDED)
              private EntityManager entityManager;
             
              @In(create=true)
              @Out(required=false)
              private User user;
             
              public GWT2SeamServiceImpl(){
                     
              }


              @Begin
              public String begin(String question) {
                      log(begin);
                      return processToString();
              }
             
              public String process(String question) {
                      log(process);
                      return processToString();
              }


              @End
              public String end(String question) {
                      log(end);
                      entityManager.persist(user);
                      return processToString();
              }
             
              @Destroy
              @Remove
              public void destroy() {
              }
             
              private void log(String desc){
                      log.info(CurrentConversationId: + Manager.instance().getCurrentConversationId());
              }
             
              private String processToString() {
                      return new StringBuilder()
                                      .append(hash:).append(hashCode())
                                      .append(entityManager:).append(entityManager.hashCode())
                                      .append(user:).append(user.hashCode())
                                      .toString();
              }


      }


      @Local
      public interface GWT2SeamServiceLocal extends GWT2SeamService {
             
              @WebRemote
              public String begin(String question);
             
              @WebRemote
              public String process(String question);
             
              @WebRemote
              public String end(String question);
             
              public void destroy();
             
      }


      The communication of a client and the server succeeded,
      but CurrentConversationId is done increment of even if I carry out process after begin.
      Furthermore, CurrentConversationId is done increment of even if I carry out only process.
      Is there the method to use the same component from begin to end?


      Thanks.

        • 1. Re: Does not conversation work in rpc from gwt?
          yoshiki

          Esena Paj wrote on Apr 22, 2010 12:22:


          Hi all.

          I want to have seam and conversation in rpc from gwt.
          This is the code of the server-side.


          @Stateful
          @Scope(ScopeType.CONVERSATION)
          @Name("gwt2SeamService")
          public class GWT2SeamServiceImpl implements GWT2SeamServiceLocal {
          
                  @Logger
                  private Log log;
                  
                  @PersistenceContext(type \= PersistenceContextType.EXTENDED)
                  private EntityManager entityManager;
                  
                  @In(create\=true)
                  @Out(required\=false)
                  private User user;
                  
                  public GWT2SeamServiceImpl(){
                          
                  }
          
                  @Begin
                  public String begin(String question) {
                          log("begin");
                          return processToString();
                  }
                  
                  public String process(String question) {
                          log("process");
                          return processToString();
                  }
          
                  @End
                  public String end(String question) {
                          log("end");
                          entityManager.persist(user);
                          return processToString();
                  }
                  
                  @Destroy
                  @Remove
                  public void destroy() {
                  }
                  
                  private void log(String desc){
                          log.info("CurrentConversationId:" \+ Manager.instance().getCurrentConversationId());
                  }
                  
                  private String processToString() {
                          return new StringBuilder()
                                          .append("hash:").append(hashCode())
                                          .append("entityManager:").append(entityManager.hashCode())
                                          .append("user:").append(user.hashCode())
                                          .toString();
                  }
          
          }
          


          @Local
          public interface GWT2SeamServiceLocal extends GWT2SeamService {
                  
                  @WebRemote
                  public String begin(String question);
                  
                  @WebRemote
                  public String process(String question);
                  
                  @WebRemote
                  public String end(String question);
                  
                  public void destroy();
                  
          }
          


          The communication of a client and the server succeeded,
          but CurrentConversationId is done increment of even if I carry out process after begin.
          Furthermore, CurrentConversationId is done increment of even if I carry out only process.
          Is there the method to use the same component from begin to end?

          Thanks.


          Click HELP for text formatting instructions. Then edit this text and check the preview.

          • 2. Re: Does not conversation work in rpc from gwt?
            yoshiki

            I settled by exchanging ConversationID with a client with a server.


            Thank you.

            • 3. Re: Does not conversation work in rpc from gwt?
              qixunyuan

              Esena Paj wrote on May 06, 2010 06:47:


              I settled by exchanging ConversationID with a client with a server.

              Thank you.


              Hi,how can you get the conversationid in gwt page? I mean the pure gwt page and not JSF and GWT integration.
              I don't know how to do it. please help me. thank you.