Results 1 to 6 of 6

Thread: Event on access to a bean

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default

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

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  4. #4

    Default



    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. #5
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  6. #6

    Default

    :?

    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...

    :?:

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •