我用com.mvp4g.client.history.PlaceService
覆盖解决了它。通过覆盖convertToken
和tokenize
方法,我可以屏蔽 GWT 浏览器 URL。
public class MyPlaceService extends PlaceService {
@Override
protected void convertToken(String token) {
super.convertToken(UrlTokenizer.decode(token));
}
@Override
public String tokenize(String eventName, String param) {
return UrlTokenizer.encode(eventName, param);
}}
最后,在我的 gwt.xml 文件中,我添加了这些行以用我自己的类“替换” PlaceService 类:
<replace-with class="com.comp.app.gwt.mvp4.myPlaceService">
<when-type-is class="com.mvp4g.client.history.PlaceService" />
</replace-with>