Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on No-Interface View

 
Sagar Shroff
Ranch Hand
Posts: 209
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers ,
I was reading this snippet in spec

3.4.4Session Bean’s No-Interface View
The container provides an implementation of a reference to a no-interface view such that when the client invokes a method on the reference, the business method on the session bean instance and any interceptor methods are invoked as needed.

I dint understood "..any interceptor methods are invoked as needed.".Can someone explain me why would i require an interceptor and an example of a scenario will be very helpful.

The Spec has also mentioned very similar quote

3.4.3Session Bean’s Business Interface
The container provides an implementation of a session bean’s business interface such that when the client invokes a method on the instance of the business interface, the business method on the session bean instance and any interceptor methods are invoked as needed

Please help me on both of this quotes in context to interceptors.


Also can some one explain why can i call only public methods through a no interface view otherwise EJBException.Why so the spec have made this as compulsion there must be some logic or reason behind which i am not aware ???


Regards,
Shroff.
 
Michal Nalewajko
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

the meaning of these snippet is that the interceptors can be binded to business methods (but not only) and they are invoked before the request enter to the business method.

request can be like this:

reference------>ejb container------>interceptor------>business method

Also can some one explain why can i call only public methods through a no interface view otherwise EJBException.Why so the spec have made this as compulsion there must be some logic or reason behind which i am not aware ???


This rule allows developers to hide some methods which they don't want to expose outside their bean (for example callback methods or private methods).
 
Sagar Shroff
Ranch Hand
Posts: 209
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michal Nalewajko wrote:
This rule allows developers to hide some methods which they don't want to expose outside their bean (for example callback methods or private methods).

can you give me an example of such scenario ? Because its still unclear to me , because hiding of method could be controlled through access-specifiers i would had made my method private then why such rule ? ?

Regards,
Shroff.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic