Questions tagged [session-scope]

A state of the Java bean that holds it during HTTP session.

A state of the Java bean that holds it during HTTP session. It allows user interaction with a web application across multiple HTTP requests. This scope is defined under (JSR 299) specification. A session scope gives a bean a contextually-defined life-cycle, which ends with the end of the HTTP session. A session-scoped bean is automatically created when needed and automatically destroyed when the context in which it was created ends. Moreover, its state is automatically shared by any clients that execute in the same context.

164 questions
63
votes
3 answers

How to invalidate session in JSF 2.0?

What is the best possible way to invalidate session within a JSF 2.0 application? I know JSF itself does not handle session. So far I could find private void reset() { HttpSession session = (HttpSession) FacesContext.getCurrentInstance() …
Niks
  • 4,802
  • 4
  • 36
  • 55
21
votes
5 answers

Are session and sessionScope the same in JSP EL?

public class LoginAction extends ActionSupport { private String username; private String password; @Override public String execute() throws Exception { ActionContext ctx = ActionContext.getContext(); Integer counter…
StrikeW
  • 501
  • 1
  • 4
  • 11
18
votes
2 answers

Access session scoped JSF managed bean in web filter

I have SessionScoped bean called userSession to keep track of the user ( username, ifLogged, etc). I want to filter some pages and therefore I need to access the bean from the webFilter I created. How do I do that? I looks like its even impossible…
user1997553
  • 233
  • 1
  • 2
  • 10
11
votes
3 answers

How does a ScopedProxy decide what Session to use?

A Singleton can not autowire a SessionBean but a ScopedProxy can. Assuming 100 users have a valid Session at the same time in the same application, how does the ScopedProxy decide what session is meant? I don't think the ScopedProxy is choosing any…
Grim
  • 1,938
  • 10
  • 56
  • 123
9
votes
1 answer

request scoped property in session scoped JSF bean

I would like to have a session scoped JSF bean with one property that is request (page) scoped. Is it possible at all?
Jarek
  • 91
  • 1
  • 2
7
votes
1 answer

Why should we make a SessionScoped ManagedBean thread safe in JSF?

I know that Application-Scope persists across multiple users, so it's obvious that we should make sure that all the ApplicationScoped ManagedBeans are thread safe. I also understand that we don't need to care about thread safety for a RequestScoped…
Bhesh Gurung
  • 50,430
  • 22
  • 93
  • 142
7
votes
2 answers

Exception - Unable to set property userLogin for managed bean credentials

For authentication purposes, I am injecting a request scoped backing bean into another session scoped bean that is going to store the logged user. Or at least it should... Following , a bit of code: Request scoped bean - managed…
Hari
  • 1,509
  • 15
  • 34
6
votes
2 answers

How to retrieve current NHibernate Session object from Castle ActiveRecord SessionScope

I have an open Castle ActiveRecord SessionScope. I need to use the nhibernate session wrapped into SessionScope. How can i retrieve the current NHibernate Session Object from SessionScope? thank you very much for the replies. [update] i have this…
manuellt
  • 669
  • 2
  • 7
  • 19
6
votes
2 answers

How to create a Spring session scoped bean based on user properties

I've developed a Spring Web-MVC application. I have some offices in my project. Each user belongs to an office. user.getOfficeType() returns an integer representing the user's office type. If the office type is 1, the user belongs to Office1 and…
Dariush Jafari
  • 5,223
  • 7
  • 42
  • 71
5
votes
1 answer

How to use @SessionScoped with Guice

Hi I am currently playing with Guice and @SessionScoped. To give it more sense, I decided to build a (very simple) authentication process. Below, I will explain each step I have done. Then I will ask you some questions. [1] I have create an…
Pierre
  • 139
  • 3
  • 8
5
votes
2 answers

CDI session scoped bean not destroyed results in memory leakage

I have a question regarding the lifecycle of session scoped CDI beans. As far as I understand, a session scoped CDI bean is constructed by the container when the session starts and destroyed when the session ends. Before the bean is destroyed the…
steven.westside
  • 259
  • 2
  • 8
4
votes
1 answer

Accessing a CDI SessionScoped bean from an EJB @Asynchronous invocation

I have a process which takes a long time to compute so it's marked as @Asynchronous in a Stateless EJB. When the process finishes, I'd like it to access a SessionScoped bean from the session which started the process to store the results. Is that…
narduk
  • 964
  • 1
  • 9
  • 19
4
votes
1 answer

How to retrieve a session-scoped bean inside AuthenticationSuccessHandler?

I have a custom AuthenticationSuccessHandler. What I want to do is to set some session data within onAuthenticationSuccess method. To store session data I want to use a session-scoped bean, which works fine within any controller. But if I try to…
Pavel
  • 1,019
  • 2
  • 10
  • 19
4
votes
3 answers

Remove/destroy session scoped CDI managed bean

I have a session scoped CDI managed bean: @Named @SessionScoped public class SampleBean implements Serializable { // ... } I need to remove this bean from the session after a certain flow for which I used the following code like as seen in…
Jini Samuel
  • 124
  • 1
  • 3
  • 13
4
votes
2 answers

How to set session scope for plugin in StructureMap 2.6?

How to set session scope for plugin in StructureMap 2.6? In previous versions it is done this way: For().CacheBy(StructureMap.InstanceScope.HttpSession).Use(); However, Visual Studio displays a warning telling that the…
Guillermo Gutiérrez
  • 17,273
  • 17
  • 89
  • 116
1
2 3
10 11