java - Wicket Session with more than one user logged in -


i building first java application wicket , have bit of problem wicket sessions.

my problem: when second user logs application overrides session first user -> both working on second session now. although both users create new session when logging in.

my code:

wicketsession.java:

public class wicketsession extends websession {  private userbean            currentuser;  public wicketsession(request request) {     super(request); }  public static wicketsession get() {     return (wicketsession) session.get(); } // getter/setter 

in application class:

@override public session newsession(request request, response response) {     return new wicketsession(request); } 

and login (short version w/o ifs, make readable):

@override public final void onsubmit() {  if (signin(wiausername, wiapassword)) {     getsession().bind();     setresponsepage(new charlistdetail()); } else {     error("unknown username/ password"); } }  private boolean signin(string username, string password) {     currentuser = userproxy.getinstance().getelementbyuser(username, password);     wicketsession.get().setcurrentuser(currentuser);     return true;     } 

this works fine 1 user. moment second user logs in

wicketsession.get().setcurrentuser(currentuser);  

sets current user new user , both logged in users same. how prevent problem?

after lots of searching net found solution.

the problem saved currentuser userbean , not string. dont know why doesn't work in wicket store user bean, it's working.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -