Announcement Announcement Module
No announcement yet.
Event on access to a bean Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Event on access to a bean

    Hi !

    I would like to publish an event when a specific bean is accessed. To do so, i'm going to realize an interception where i will pubish my event.

    I would like the event to trigger a another treatement :
    When the event is published, another objet check if there is an another user browsing the web sites , if so it creates a pop-up to inform him of the event...

    I think i know how to realize the interception, but i don't know to write the object that will be triggered...

  • #2
    If its all in one JVM, the ApplicationContext can be used to publish events that are sent automatically to event listeners.


    • #3
      It's not very easy to trigger a popup when you want to. A web browser does a request when the user wants to - the server doesn't connect back to the client (he simply can't in most cases due to firewall).
      You need some sort of software on your client site that you can communicate with (a java applet for example) or you can put some flag inside the offender user httpSession so on his very next request something happens (like the popup).

      Probably you can do even more with some nice JavaScript hacks but then again this is the Spring forum.


      • #4

        You're right.

        My idea is , once the event is published, to "enable" the interception of the bean. Before the user access to the page, the interception will create the pop-up ( "hey user : some stuff changed") and then proceed to the regular page...

        So, no real Javascript ...


        • #5
          Anyways, you don't necessary have to create events for this case. You can simply call the desired method if needed. Events are very good when you don't know the exact number of listeners (and you have more then one).


          • #6

            You're probably right, but i wanted to try out the event propagation feature of Spring... But I don't really see how to use it in "deconnected" environements such as the web...