0

I have a Session Scoped Bean:

@SessionScoped
public class UserSession {
    User user;
}

During my LoginView, I throw a SecurityException:

throw new java.lang.SecurityException("You need to login!");

Which will be redirected by the web.xml to SelectUserBean

Now here is the strange thing which I really do not understand: Before I throw the SecurityException, the UserSession has id UserSession@123456 and user Foo. Now in the SelectUserBean the UserSession has a new id and the user is null.

in my faces-config I had Primefaces exception handling:

<el-resolver>       
  org.primefaces.application.exceptionhandler.PrimeExceptionHandlerELResolver
</el-resolver>

and

<factory>
    <exception-handler-factory>
       org.primefaces.application.exceptionhandler.PrimeExceptionHandlerFactory
    </exception-handler-factory>
</factory> 

after removing, it works as expected. any ideas on this?

Why does this happen? I thought since it is a SessionScoped bean it must be the same value.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
matthias
  • 1,938
  • 23
  • 51

1 Answers1

0

Something in the chain created a new session, ergo you got a new session bean.

user207421
  • 305,947
  • 44
  • 307
  • 483