Dead Programmer
Dead Programmer

Reputation: 12585

EJB 3 Stateless bean pass data to interceptor

How to pass data from stateless session bean to the method level interceptor for the current request. For each client request we need to have its own local data and should not conflict.

Upvotes: 0

Views: 763

Answers (1)

Nayan Wadekar
Nayan Wadekar

Reputation: 11622

If you want to pass data to & from interceptors, you can try looking at methods of InvocationContext interface.

# java.lang.Object[] getParameters : Returns the parameter values that will be passed to the method of the target class.

# setParameters(java.lang.Object[] params) : Sets the parameter values that will be passed to the method of the target class.

Therefore, if you want to pass some data to interceptor, you can pass it as parameter & fetch them later in interceptor. Again, after processing, you can set appropriate data as parameter, which will be received by the final method.

Upvotes: 2

Related Questions