Results 1 to 2 of 2

Thread: ApplicationListener with access to current request

  1. #1
    Join Date
    Sep 2004
    Posts
    346

    Default ApplicationListener with access to current request

    Is it possible to define a spring bean that extends ApplicationListener with access to current request? this way in the onApplicationEvent you can manipulate request attributes as a side effect of an application event firing. This could cause particular messages to be published to the screen as a result in response to the events that occured.

  2. #2
    Join Date
    Aug 2004
    Location
    Toulouse, France
    Posts
    148

    Default

    You may see this as a hack (well, ok, you should) but instead of inserting web notion into the application listener, which is doable but requires to extends WebApplicationContext, etc... you could use a ThreadLocal to store the current request and access it in any application listener aware of this ThreadLocal ...
    This can be a dirty hack but useful when you don't want to break apis to pass a new parameter...

    Olivier

Similar Threads

  1. Replies: 3
    Last Post: Dec 4th, 2010, 07:52 AM
  2. [SOLVED] Tiles integration with Spring
    By foxmask in forum Architecture
    Replies: 8
    Last Post: Apr 15th, 2010, 12:36 AM
  3. Replies: 17
    Last Post: Jan 2nd, 2007, 01:43 PM
  4. Hibernate Long Session Per Flow?
    By akw in forum Web Flow
    Replies: 21
    Last Post: Dec 12th, 2005, 08:06 PM
  5. Replies: 9
    Last Post: Nov 1st, 2005, 10:36 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
  •