File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Initializing a List in Interceptor (or EJB) in the deployment descripter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Initializing a List in Interceptor (or EJB) in the deployment descripter" Watch "Initializing a List in Interceptor (or EJB) in the deployment descripter" New topic
Author

Initializing a List in Interceptor (or EJB) in the deployment descripter

Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 100
Hello,

is it possible to initialize a List in an Interceptor (or EJB) in the deployment descriptor?
I am trying to implement the Observer Pattern with an Interceptor as the Observable. The Observers must be injected into the Interceptor.
I thought I saw something like this but I cannot find an example. Perhaps I am confusing it with Spring.

I am using EJB 3.0.

Thanks,

Hans
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9963
    
163

The spec doesn't have anything for initializing the state of the interceptors via deployment descriptors. Instead you can actually mark a specific method which would do the initialization (it's called a post-construct method). How you initiliaze that data in the post-construct method isn't governed by the spec.

[My Blog] [JavaRanch Journal]
Akshay Sahu
Greenhorn

Joined: Sep 04, 2009
Posts: 26

Hi,

1. EJB 3 Interceptors can have method annotated @PostConstruct (Applicable for Stateless and Stateful Session Beans).

2. Write your observer update code into the post construct method that automatically updates the value at your desired location.

Akshay Sahu
OCBCD (EJB 3), OCJP (Java SE 6), MCTS (MS SQL Server 2005)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Initializing a List in Interceptor (or EJB) in the deployment descripter
 
Similar Threads
invoker-mbean missing
Help need to exclude list of bean classes from interceptors
Redirect url with in the action class
Query rgd interceptor invocation order
Life-Cycle Event Interceptor Method Skipped