quarks
quarks

Reputation: 35276

GWT Fragment Identifier works in hosted mode and not in compiled mode (Tomcat)

I have this code below which works when running in hosted/debug mode however it does not work when deployed in Tomcat.

History.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(ValueChangeEvent<String> event) {
                // call update model, and eventually app will show the appropriate view...

            }
        });

I code above responsibility is to catch the event when user type something like this in the browser:

http://http://127.0.0.1:8888/index.html?gwt.codesvr=127.0.0.1:9997#user123

Works well in hosted mode, but when deployed in Tomcat and accessed via the browser:

http://127.0.0.1:8888/index.html#user123

it shows blank page.

EDIT: Unless gwt app is first loaded and typing FI works.

Upvotes: 0

Views: 196

Answers (1)

Peter Knego
Peter Knego

Reputation: 80330

Please read this: What is need History.fireCurrentHistoryState() in GWT History?

When you load http://127.0.0.1:8888/index.html#user123 for the first time, you registered your history handler after the history event has already happened. If you reload the page then it will fire.

You need to call History.fireCurrentHistoryState() after you registered the history handler to "re-fire" the event.

Upvotes: 1

Related Questions