Announcement Announcement Module
Collapse
No announcement yet.
ApplicationListener with access to current request Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment

    Working...
    X