args.put("id", new JSONNumber(Integer.parseInt(idString)));
rpcProxy.rpcCall("get_embedded_query_url_token", args, new JsonRpcCallback() {
@Override
public void onSuccess(JSONValue result) {
String tokenString = Utils.jsonToString(result);
HistoryToken token;
try {
token = HistoryToken.fromString(tokenString);
} catch (IllegalArgumentException exc) {
NotifyManager.getInstance().showError("Invalid embedded query token " +
tokenString);
return;
}
// since this is happening asynchronously, the history may have changed, so ensure
// it's set back to what it should be.
HistoryToken shortToken = new HistoryToken();
shortToken.put(HISTORY_TOKEN, idString);
CustomHistory.newItem(shortToken);
CustomHistory.simulateHistoryToken(token);
}
});