javax.enterprise.context

Annotation Type ConversationScoped


  • @Target(value={TYPE,METHOD,FIELD})
     @Retention(value=RUNTIME)
     @Documented
     @NormalScope(passivating=true)
     @Inherited
    public @interface ConversationScoped

    Specifies that a bean is conversation scoped.

    The conversation scope is active:

    • during all standard lifecycle phases of any Servlet request.

    The conversation context provides access to state associated with a particular conversation. Every Servlet request has an associated conversation. This association is managed automatically by the container according to the following rules:

    • Any Servlet request has exactly one associated conversation.
    • The conversation associated with a Servlet request is determined at the beginning of the request and does not change during the request.

    Any conversation is in one of two states: transient or long-running.

    • By default, a conversation is transient
    • A transient conversation may be marked long-running by calling Conversation.begin()
    • A long-running conversation may be marked transient by calling Conversation.end()

    All long-running conversations have a string-valued unique identifier, which may be set by the application when the conversation is marked long-running, or generated by the container.

    If the conversation associated with the current Servlet request is in the transient state at the end of a Servlet request, it is destroyed, and the conversation context is also destroyed.

    If the conversation associated with the current Servlet request is in the long-running state at the end of a Servlet request, it is not destroyed. The long-running conversation associated with a request may be propagated to any Servlet request via use of a GET request parameter named cid containing the unique identifier of the conversation. In this case, the application must manage this request parameter.

    If the current Servlet request is a JSF request, and the conversation is in long-running state, it is propagated according to the following rules:

    • The long-running conversation context associated with a request that renders a JSF view is automatically propagated to any faces request (JSF form submission) that originates from that rendered page.
    • The long-running conversation context associated with a request that results in a JSF redirect (a redirect resulting from a navigation rule or JSF NavigationHandler) is automatically propagated to the resulting non-faces request, and to any other subsequent request to the same URL. This is accomplished via use of a GET request parameter named cid containing the unique identifier of the conversation.

    When no conversation is propagated to a Servlet request, the request is associated with a new transient conversation. All long-running conversations are scoped to a particular HTTP servlet session and may not cross session boundaries. In the following cases, a propagated long-running conversation cannot be restored and reassociated with the request:

    • When the HTTP servlet session is invalidated, all long-running conversation contexts created during the current session are destroyed, after the servlet service() method completes.
    • The container is permitted to arbitrarily destroy any long-running conversation that is associated with no current Servlet request, in order to conserve resources.
    Author:
    Gavin King, Pete Muir
    See Also:
    Conversation, NonexistentConversationException, BusyConversationException

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/08/2025 20:19:18 Cette version de la page est en cache (à la date du 21/08/2025 20:19:18) afin d'accélérer le traitement.
Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.

Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/enterprise/context/ConversationScoped.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, ConversationScoped (Java(TM) EE 7 Specification APIs)

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.