I try to save user details in a vaadinsessionscope. I have the class DominoSession like
@VaadinSessionScope
public class DominoSession {
private VaadinRequest vaadinrequest = null;
private static DominoSession instance = null;
private static Session dominosession = null;
private String username = "";
private String usernamecommon = "";
private Vector<String> roles = new Vector<String>();
private static Config configuration;
private Dialog restartDialog = new MessageDialog("Starten Sie die Anwendung bitte über Notes neu.");
public DominoSession(
Session session,
String username,
String usercommon,
Vector<String> roles
) {
dominosession = session;
this.username = username;
this.usernamecommon = usercommon;
this.roles = roles;
}
public DominoSession(VaadinRequest vaarequest) {
this.vaadinrequest = vaarequest;
Notification notification = new Notification(
"Ihre Session ist abgelaufen. "
+ "Starten Sie die Anwendung bitte über Notes neu. ",
5000,Position.TOP_START);
DominoSession.configuration = Config.getInstance();
Cookie[] kekse = this.vaadinrequest.getCookies();
String ltpatoken = "";
for(Cookie keks:kekse) {
if(keks.getName().equalsIgnoreCase("LtpaToken"))ltpatoken = keks.getValue();
}
if(ltpatoken.length()>0) {
try {
long startTime = System.currentTimeMillis();
dominosession = NotesFactory.createSession(Config.getInstance().getDominoDomain(), ltpatoken );
long estimatedTime = System.currentTimeMillis() - startTime;
System.out.println("get domino session time: " + estimatedTime );
System.out.println(dominosession.getClass().getName());
this.username = dominosession.getUserName();
this.usernamecommon = dominosession.getCommonUserName();
Database dominodb = dominosession.getDatabase("", configuration.getDominoDbPath());
this.roles = dominodb.queryAccessRoles(dominosession.getUserName());
DominoSession.instance = this;
if(dominodb != null) dominodb.recycle();
} catch (NotesException e) {
e.printStackTrace();
if(e.getMessage().contains("Single Sign-on Token has expired")) {
if(!UtilsBeanProvider.wasRestartMessageShown() ) {
restartDialog.open();
UtilsBeanProvider.setRestartMessageShown(true);
}
}
}
} else {
if(!UtilsBeanProvider.wasRestartMessageShown() ) {
restartDialog.open();
UtilsBeanProvider.setRestartMessageShown(true);
}
}
}
/* new */
public static DominoSession getDominosession() {
if(instance == null) {
DominoSession.instance = new DominoSession(VaadinRequest.getCurrent());
}
return instance;
}
/********************************* */
private void openDialog(String dialogMessage) {
....
}
}
and the Mainview looks like
@UIScope
@Component
public class MainView extends VerticalLayout {
@Autowired
public MainView(StatisticView statisticView, StatisticRoleFactory statisticRoleFactory) {
System.out.println("Main View = " + UtilsBeanProvider.getUser().getUsername());
}
}
Then If I and a colleague of mine opens the Route. We both see my username? I thought the vaadinsession depends on httpsession?