• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

question about interceptor methods invocation order

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there are two interceptor classes, one is annotated on the bean class and the other is defined via xml descriptor, which one is called first?
 
Mellon Sun
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested that in GlassFish V2 via NetBean6.5.

The annotated one on the class is called prior to the descriptor defined one. And if annotated a interceptor on the class and assembled it via descriptor again, the interceptor's method is called twice.

Does the specification prove this somewhere?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The order of invocation is described in chapter 12 :

12.1 Overview
12.3.1 Multiple Business Method Interceptor Methods
12.4.1 Multiple Callback Interceptor Methods for a Life Cycle Callback Event
12.8.2 Specification of the Binding of Interceptors to Beans

The deployment descriptor may be used to augment the interceptors and interceptor methods defined by means of annotations. When the deployment descriptor is used to augment the interceptors specified in annotations, the interceptor methods specified in the deployment descriptor will be invoked after those specified in annotations, according to the ordering specified in sections 12.3.1 and 12.4.1. The interceptor-order deployment descriptor element may be used to override this ordering.
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic