public class SessionScope extends ShutdownAwareScope
RequestContextListener
is used for accessing
the request and the session.Modifier and Type | Class and Description |
---|---|
class |
SessionScope.SessionBeans
Session beans holder and manager.
|
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
SESSION_BEANS_NAME |
destroyableBeans
Constructor and Description |
---|
SessionScope(PetiteContainer pc) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Scope referenceScope)
Returns
true if a bean of referenced scope can be
injected into target bean of this scope. |
protected javax.servlet.http.HttpSession |
getCurrentHttpSession()
Returns request from current thread.
|
protected java.util.Map<java.lang.String,BeanData> |
getSessionMap(javax.servlet.http.HttpSession session)
Returns instance map from http session.
|
java.lang.Object |
lookup(java.lang.String name)
Lookups for bean name.
|
void |
register(BeanDefinition beanDefinition,
java.lang.Object bean)
Registers the bean within the current scope.
|
protected java.util.Map<java.lang.String,BeanData> |
registerSessionBeans(javax.servlet.http.HttpSession httpSession)
Registers new session destroy callback if not already registered.
|
void |
remove(java.lang.String name)
Removes the bean from the scope entirely.
|
void |
shutdown()
Shutdowns the Session scope.
|
destroyBean, isBeanDestroyable, registerDestroyableBeans, totalRegisteredDestroyableBeans
public SessionScope(PetiteContainer pc)
protected java.util.Map<java.lang.String,BeanData> registerSessionBeans(javax.servlet.http.HttpSession httpSession)
protected java.util.Map<java.lang.String,BeanData> getSessionMap(javax.servlet.http.HttpSession session)
public void shutdown()
shutdown
in interface Scope
shutdown
in class ShutdownAwareScope
public java.lang.Object lookup(java.lang.String name)
Scope
null
if bean is not
found or yet registered.public void register(BeanDefinition beanDefinition, java.lang.Object bean)
Scope
BeanDefinition
.
Also it may register destroy methods of a bean within this scope.public void remove(java.lang.String name)
Scope
public boolean accept(Scope referenceScope)
Scope
true
if a bean of referenced scope can be
injected into target bean of this scope. Otherwise, returns
false
, which may be a sign for scoped proxy to be
injected.
In general, injection of 'shorter' reference scopes
into the 'longer' target scopes should not be accepted.
In other words, if reference scope is 'longer' or equal (same),
this method should return true
.
Helpful is to ask the following question: "May the reference scope bean be injected into bean of this scope?".
protected javax.servlet.http.HttpSession getCurrentHttpSession()
Copyright © 2003-present Jodd Team