How is the session defined in @SessionScoped
CDI bean?
Is this annotation valid only when called from Servlet container, where the session is well defined in form of HttpSession
?
If not, than how an EJB with @Inject @SessionScoped MyBean myBean
can know what the session really is? I mean, methods of this EJB could have been invoked by a standalone client, RESTful WS or by some other view.
What should happen in such case? Should the annotation have no meaning, should it inject fresh MyBean
instance for each request or maybe it should retain the same instance across all requests?