Пример #1
0
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   String uri = req.getRequestURI();
   if (uri.endsWith("/display")) {
     printInfo(resp.getWriter());
   } else if (uri.endsWith("/redirect")) {
     resp.sendRedirect("servlet/display"); // do a redirect, the cid is not propagated;
   } else if (uri.endsWith("/begin")) {
     conversation.begin();
     printInfo(resp.getWriter());
   } else if (uri.endsWith("/end")) {
     conversation.end();
     printInfo(resp.getWriter());
   } else if (uri.endsWith("/set")) {
     setMessage(req);
     printInfo(resp.getWriter());
   } else if (uri.endsWith("/invalidateSession")) {
     observer.reset();
     req.getSession().invalidate();
     printInfo(resp.getWriter());
   } else if (uri.endsWith("/listConversationsDestroyedWhileBeingAssociated")) {
     PrintWriter writer = resp.getWriter();
     writer.append("ConversationsDestroyedWhileBeingAssociated: ");
     printSessionIds(writer, observer.getAssociatedConversationIds());
   } else if (uri.endsWith("/listConversationsDestroyedWhileBeingDisassociated")) {
     PrintWriter writer = resp.getWriter();
     writer.append("ConversationsDestroyedWhileBeingDisassociated: ");
     printSessionIds(writer, observer.getDisassociatedConversationIds());
   } else {
     resp.setStatus(404);
   }
   resp.setContentType("text/plain");
 }
Пример #2
0
 public String salvar() {
   cadastroOfertante.cadastrarOfertante(ofertante);
   if (!conversation.isTransient()) {
     conversation.end();
   }
   return "principal?faces-redirect=true";
 }
Пример #3
0
  @WebRemote
  @Transactional
  public void savePerson() throws Exception {
    if (person.getPersonId() == null) {
      entityManager.persist(person);
    } else {
      person = entityManager.merge(person);
    }

    conversation.end();
  }
 /**
  * Deletes the customer from the registry
  *
  * @return to showCustomers if the delete was success
  */
 public String action() {
   if (!conv.isTransient()) {
     conv.end();
     Logger.getAnonymousLogger().log(Level.INFO, "CONVERSATION ENDS");
   }
   try {
     String userName = deleteCustomerBackingBean.getUserName();
     customerRegistryBean.remove(userName);
     return "showCustomers?faces-redirect=true"; // Go back
   } catch (Exception e) {
     // Not implemented
     // return "error?faces-redirect=true&cause=" + e.getMessage();
     return null;
   }
 }
  // Support updating and deleting Book entities
  public String update() {
    conversation.end();

    try {
      if (id == null) {
        target.request().post(Entity.entity(author, MediaType.APPLICATION_XML));
        return "search?faces-redirect=true";
      } else {
        target.request().put(Entity.entity(author, MediaType.APPLICATION_XML));
        return "view?faces-redirect=true&id=" + author.getId();
      }
    } catch (Exception e) {
      FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(e.getMessage()));
      return null;
    }
  }
  public String delete() {
    conversation.end();

    try {

      target
          .path("{id}")
          .resolveTemplate("id", getId())
          .request(MediaType.APPLICATION_XML)
          .delete();

      return "search?faces-redirect=true";
    } catch (Exception e) {
      FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(e.getMessage()));
      return null;
    }
  }
Пример #7
0
 public void conversationEnd() {
   if (!conversation.isTransient()) {
     conversation.end();
   }
 }
Пример #8
0
 public void endConversation() {
   if (!conversation.isTransient()) {
     conversation.end();
     System.out.println("========> FINALIZANDO CONVERSACION: ");
   }
 }
Пример #9
0
 public String cancelar() {
   if (!conversation.isTransient()) {
     conversation.end();
   }
   return "principal?faces-redirect=true";
 }
Пример #10
0
 public String merge() {
   getEntityManager().joinTransaction();
   getEntityManager().merge(address);
   conversation.end();
   return "merge";
 }
Пример #11
0
 public String create() {
   getEntityManager().joinTransaction();
   getEntityManager().persist(address);
   conversation.end();
   return "create";
 }
Пример #12
0
 public void end() {
   log.debug("End conversation: " + delegate.getId());
   delegate.end();
 }
 public void endConversation() {
   if (!conversation.isTransient()) {
     conversation.end();
     System.out.println("Finalizando la conversación en Users");
   }
 }