Hello,
I have following problem:
I want to open different browser windows with different URI parameters. My problem is, that I can not map the request to the right UI.
Example:
URL = localhost:8080/?userName=abc
→ UI will be created for user = abc
URL = localhost:8080/?userName=xyz
→ UI will be created for user = xyz
The RequestHandler is added to the session.
session.addRequestHandler(myRequestHandler);
But in the RequestHandler I can not differ, which browser window (UI) sends the request, so I can not handle the URI parameters correctly only for the one UI, that should listen to it.
public class MyRequestHandler implements RequestHandler {
private MyUI ui;
public MyRequestHandler(MyUI ui) {
this.ui = ui;
}
@Override
public boolean handleRequest(final VaadinSession session, final VaadinRequest request, final VaadinResponse response) throws IOException {
// Here I would like to make some stuff on my UI
ui.setUser("...");
return false;
}
}
My UI would look like this:
public class MyUI extends UI {
@Override
protected void init(final VaadinRequest request) {
MyRequestHandler myRequestHandler = new MyRequestHandler(this);
getSession().addRequestHandler(myRequestHandler);
}
}
But the request do not include any informations about the UI (UI_ID). Furthermore, all RequestHandlers are called, when one browser window will be refreshed.
I think, this is a very common problem with web applications. How can I handle different URI requests for different UIs???
Best regards and thanks,
Tino
PS: Of course I do not want to login 2 different users for one HTTP session. This is just a simple example!!! Please do not discuss on that.