我有一个用纯GWT编写的webapp example.com
。显然是webapp
有动态链接,例如example.com/#/link1
。
我想从我的网站外部访问example.com/#/link1
。例如。我想在facebook.com上发布example.com/#/link1
链接,以便我的朋友可以看到它。但是,当有人点击该链接时,即使我的EntryPoint中有valueChangeHandler,也会将他带到example.com
,而不是example.com/#/link1
。
所以我的问题是,如何从我的GWT页面外部访问动态链接。
编辑:找到答案:在EntryPoint中执行以下操作
public void onModuleLoad() {
String initState = History.getToken();
//This is your initial token for your gwt ap
System.out.println(initState);
//Do any stuff you want to here, like init some stuff in your app, and finally:
History.newItem(initState);
//That las line calls the initial state of your app. This worked for me because I
//changed the history state in between, so I had to save initialState, do stuff and then
//fire inistial state.
}