@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"); }
public String salvar() { cadastroOfertante.cadastrarOfertante(ofertante); if (!conversation.isTransient()) { conversation.end(); } return "principal?faces-redirect=true"; }
@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; } }
public void conversationEnd() { if (!conversation.isTransient()) { conversation.end(); } }
public void endConversation() { if (!conversation.isTransient()) { conversation.end(); System.out.println("========> FINALIZANDO CONVERSACION: "); } }
public String cancelar() { if (!conversation.isTransient()) { conversation.end(); } return "principal?faces-redirect=true"; }
public String merge() { getEntityManager().joinTransaction(); getEntityManager().merge(address); conversation.end(); return "merge"; }
public String create() { getEntityManager().joinTransaction(); getEntityManager().persist(address); conversation.end(); return "create"; }
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"); } }