Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-874

observe @javax.faces.bean.RequestScoped via @javax.enterprise.context.Initialized and @javax.enterprise.context.Destroyed

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.0
    • 1.4.0
    • JSF-Module
    • None

    Description

      currently it's supported to observe faces-requests via org.apache.deltaspike.core.api.lifecycle.Initialized and org.apache.deltaspike.core.api.lifecycle.Destroyed

      since cdi 1.1 there are annotations with the same name.
      to avoid confusion, we can support those annotations optionally (if cdi 1.1+ is available). both cdi 1.1+ annotations require the corresponding scope-annotation as value. since javax.enterprise.context.RequestScoped is supported out-of-the-box and this event is about the faces-request, we have to use javax.faces.bean.RequestScoped.

      the benefit is that it's possible to observe faces-requests via std. annotations and it's possible to access the faces-context (which isn't the case with an observer for javax.enterprise.context.RequestScoped).

      cdi 1.1+ out-of-the-box support:

          protected void onRequestStart(@Observes @javax.enterprise.context.Initialized(javax.enterprise.context.RequestScoped.class) Object payload) {
              //...
          }
      
          protected void onRequestEnd(@Observes @javax.enterprise.context.Destroyed(javax.enterprise.context.RequestScoped.class) Object payload) {
              //...
          }
      

      ds observer for cdi 1.0+

          protected void onFacesRequestStart(@Observes @org.apache.deltaspike.core.api.lifecycle.Initialized FacesContext facesContext) {
              //...
          }
      
          protected void onFacesRequestEnd(@Observes @org.apache.deltaspike.core.api.lifecycle.Destroyed FacesContext facesContext) {
              //...
          }
      

      additional option for cdi 1.1+ introduced by this ticket:

          protected void onFacesRequestStart(@Observes @javax.enterprise.context.Initialized(javax.faces.bean.RequestScoped.class) FacesContext facesContext) {
              //...
          }
      
          protected void onFacesRequestEnd(@Observes @javax.enterprise.context.Destroyed(javax.faces.bean.RequestScoped.class) FacesContext facesContext) {
              //...
          }
      

      Attachments

        Activity

          People

            gpetracek Gerhard Petracek
            struberg Mark Struberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: