Re: Getting username from url only works after refresh

2016-06-01 Thread Olar Andrei
If someone may face this problem again, I solved it like this: In the ClientFactoryImpl I replaced the following: private final EventBus eventBus = new SimpleEventBus(); private final PlaceController placeController = new PlaceController(eventBus); private final LoginView loginView = new LoginVie

Re: Getting username from url only works after refresh

2016-06-01 Thread Olar Andrei
This is the ActivityMapper public class AppActivityMapper implements ActivityMapper { private ClientFactory clientFactory; public AppActivityMapper(ClientFactory clientFactory) { super(); this.clientFactory = clientFactory; } @Override public Activity getActivity(Place place) { if (place instan

Re: Getting username from url only works after refresh

2016-06-01 Thread Thomas Broyer
Where and when and how is UserActivity constructed? Where does the UserPlace come from? On Tuesday, May 31, 2016 at 5:22:21 PM UTC+2, Olar Andrei wrote: > > I've tried that before, and I didn't managed to get the username to be > visible in my *ViewImpl...* > > For example. This is the structure

Re: Getting username from url only works after refresh

2016-06-01 Thread Jens
> About the code splitting stuff. Because the browser downloads code before > he needs it. > The split point itself will be loaded once you click your login button. Once the split point has been loaded the performUserConnection() method will be called. But depending on your code structure it

Re: Getting username from url only works after refresh

2016-06-01 Thread Olar Andrei
I'll take your option into consideration. But for now I'm running out of time and I want to know how to fix the problem specified in my previous post. About the code splitting stuff. Because the browser downloads code before he needs it. marți, 31 mai 2016, 01:25:10 UTC+3, Olar Andrei a scris:

Re: Getting username from url only works after refresh

2016-06-01 Thread Chad Vincent
For some reason, passing the username around via the URL seems like a code smell to me. I'm not sure if it's actually better or not, but I store the User object from the server (less password hash) in a singleton (and the session, in case of a full refresh). I also have all my Place content se

Re: Getting username from url only works after refresh

2016-06-01 Thread Olar Andrei
Hello, I've tried a little trick today, because I still belive the browser downloads code he does not need before he actually needs it. I placed this: Window.Location.reload(); inside my *UserViewImpl, *so it would reload after the login. The problem is that when the application starts with the

Re: Getting username from url only works after refresh

2016-05-31 Thread Jens
As said what you have done is generally fine in terms of passing data to a new place. I am saying that you have a bug somewhere in your code that results in a blank "logged in as: " widget because when you do placeController.goTo(new UserPlace(username)) then your UserActivity should be created

Re: Getting username from url only works after refresh

2016-05-31 Thread Olar Andrei
Ok. Then let me be a little more precise. How do you normally pass a variable between 2 places. How should i access my username from the UserViewImpl knowing the facts above ? I've tried using History.getToken(), and when the page gets loaded the username does not appear (i have a widget which

Re: Getting username from url only works after refresh

2016-05-31 Thread Jens
The only issue I can see with the above code is that you have not implemented hashcode/equals for your places. However GWT expects you do implement both methods correctly for your places. I am still under the impression that it should just work, especially because you use placeController.goTo(n

Re: Getting username from url only works after refresh

2016-05-31 Thread Olar Andrei
I've tried that before, and I didn't managed to get the username to be visible in my *ViewImpl...* For example. This is the structure I have: *UserActivity* public class UserActivity extends AbstractActivity implements UserView. Presenter { private ClientFactory clientFactory; private String

Re: Getting username from url only works after refresh

2016-05-30 Thread Jens
Well there is nothing wrong with the code you posted. I guess your issue is in some other code. You said you are splitting the URL String, which sounds like you do this manually? Actually GWT already does this using the AdminPlace and its Tokenizer. Whenever you visit the above URL you should g

Getting username from url only works after refresh

2016-05-30 Thread Olar Andrei
My login based application, requires to always know the username of the logged in user. (MVP) . So I'm getting the username from the url, but when the page opens after the login succeeded, I can't get the username from the url, because it does not appear to exists, but it is there. It only wor