private void updateConversationId() { Manager manager = Manager.instance(); conversationId = manager.isLongRunningConversation() ? manager.getCurrentConversationId() : manager.getParentConversationId(); }
public String getParameterName() { return Manager.instance().getConversationIdParameter(); }
protected void handleConversationPropagation() { Manager.instance().handleConversationPropagation( request.getParameterMap() ); }
/** * Add the conversation id to a URL, if necessary * * @deprecated use encodeConversationId(String url, String viewId) */ public String encodeConversationId(String url) { //DONT BREAK, icefaces uses this return encodeConversationIdParameter( url, getConversationIdParameter(), getCurrentConversationId() ); }
/** * Get the timeout for this conversation instance. * @return the timeout in millis */ public Integer getTimeout() { return timeout==null ? Manager.instance().getCurrentConversationTimeout() : timeout; }
public String getDescription() { return description==null ? Manager.instance().getCurrentConversationDescription() : description; }
/** * Get the conversation id. */ public String getId() { return Manager.instance().getCurrentConversationId(); }
/** * Puts document in store and redirects */ private void redirectExport() { String viewId = Pages.getViewId(FacesContext.getCurrentInstance()); String baseName = Pages.getCurrentBaseName(); DocumentData documentData = new ByteArrayDocumentData(baseName, excelWorkbook.getDocumentType(), excelWorkbook.getBytes()); String id = DocumentStore.instance().newId(); String url = DocumentStore.instance().preferredUrlForContent(baseName, excelWorkbook.getDocumentType().getExtension(), id); url = Manager.instance().encodeConversationId(url, viewId); DocumentStore.instance().saveData(id, documentData); try { FacesContext.getCurrentInstance().getExternalContext().redirect(url); } catch (IOException e) { throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not redirect to #0", url), e); } }
|| event.getFacesContext().getResponseComplete()) ) Manager.instance().beforeRedirect(); if ( Manager.instance().isLongRunningConversation() ) Manager.instance().getConversationIdParameter(), Manager.instance().getCurrentConversationId() );
/** * Is there a long running conversation associated with the current request? */ protected boolean isLongRunningConversation() { return Manager.instance().isLongRunningConversation(); }
/** * Restore the page and conversation contexts during a JSF request */ protected void afterRestoreView(FacesContext facesContext) { boolean conversationFound = Contexts.isPageContextActive() ? Contexts.getPageContext().isSet("org.jboss.seam.jsf.SeamPhaseListener.conversationFound") : false; FacesLifecycle.resumePage(); Map parameters = facesContext.getExternalContext().getRequestParameterMap(); if (!conversationFound) // there is exceptional case when restoring of conversation wasn't called while page context was lazily initialized { ConversationPropagation.instance().restoreConversationId(parameters); conversationFound = Manager.instance().restoreConversation(); } FacesLifecycle.resumeConversation( facesContext.getExternalContext() ); postRestorePage(facesContext, parameters, conversationFound); }
if ( isLongRunningConversation() ) log.debug("Storing conversation state: " + getCurrentConversationId()); touchConversationStack( getCurrentConversationIdStack() ); log.debug("Discarding conversation state: " + getCurrentConversationId()); removeCurrentConversationAndDestroyNestedContexts(session); Manager.instance().conversationTimeout(session);
protected void afterResponseComplete(FacesContext facesContext) { //responseComplete() was called by one of the other phases, //so we will never get to the RENDER_RESPONSE phase //Note: we can't call Manager.instance().beforeRedirect() here, //since a redirect is not the only reason for a responseComplete ExternalContext externalContext = facesContext.getExternalContext(); Manager.instance().endRequest( externalContext.getSessionMap() ); FacesLifecycle.endRequest( facesContext.getExternalContext() ); }
private void restoreConversation() { HttpServletRequest request = httpServletRequest(); if (request == null) return; ServletLifecycle.beginRequest(request); ServletContexts.instance().setRequest(request); ConversationPropagation.instance().restoreConversationId( request.getParameterMap() ); Manager.instance().restoreConversation(); ServletLifecycle.resumeConversation(request); Manager.instance().handleConversationPropagation( request.getParameterMap() ); this.iRestoredTheConversation = true; }
/** * Changes the thread's current conversation context to the one that holds a reference to this * component. This is necessary if a nested conversation is making a call to a component in * a parent conversation. */ private String switchToConversationContextOfComponent(Component component) { Manager manager = Manager.instance(); if (manager.isNestedConversation()) { String currentCid = manager.getCurrentConversationId(); String residentCid = manager.getCurrentConversationEntry().findPositionInConversationStack(component); if (!currentCid.equals(residentCid)) { Contexts.getConversationContext().flush(); Manager.instance().switchConversation(residentCid, false); return currentCid; } } return null; }
(Manager) Contexts.getEventContext().get(Manager.class) : (Manager) request.getAttribute( Seam.getComponentName(Manager.class) ); String conversationId = manager==null ? null : manager.getCurrentConversationId(); Manager.instance().initializeTemporaryConversation(); Manager.instance().restoreConversation();
private void promoteConversation() { try { if (!Manager.instance().isLongRunningConversation()) { Manager.instance().setLongRunningConversation(true); this.iPromotedTheConversation = true; } } catch (IllegalStateException e) { // ignore } }
/** * Make a long-running conversation temporary. */ public void endConversation(boolean beforeRedirect) { if ( isLongRunningConversation() ) { log.debug("Ending long-running conversation"); if ( Events.exists() ) Events.instance().raiseEvent(EVENT_CONVERSATION_END); setLongRunningConversation(false); destroyBeforeRedirect = beforeRedirect; endNestedConversations( getCurrentConversationId() ); storeConversationToViewRootIfNecessary(); } unlockConversation(); }
String conversationId = Manager.instance().getCurrentConversationId(); if (conversationId != null) Manager.instance().endRequest( new ServletRequestSessionMap(request) );
private void restoreSyntheticConversationId(Map parameters) { //Next, try to get the conversation id from the globally defined request parameters Manager manager = Manager.instance(); //TODO: move the conversationIdParameter to this class! if ( isMissing(conversationId) ) { conversationId = getRequestParameterValue( parameters, manager.getConversationIdParameter() ); } if ( isMissing(parentConversationId) ) { parentConversationId = getRequestParameterValue( parameters, manager.getParentConversationIdParameter() ); } }