List of usage examples for com.google.gwt.coreext.client JSON parse
public static JavaScriptObject parse(String jsonStr) throws JSONParseException
From source file:com.google.speedtracer.breaky.worker.BreakyWorker.java
License:Apache License
/** * On a message, validate./*w ww .j a v a 2 s . co m*/ * If invalid, report to the host */ public void onMessage(MessageEvent event) { JavaScriptObject record = JSON.parse(event.getDataAsString()); JsonSchemaResults results = validator.validate(record); if (!results.isValid()) { postMessage(JSON.stringify(createMessage(record, results.formatResultsText(event.getDataAsString())))); } }
From source file:com.google.speedtracer.client.messages.EventRecordMessage.java
License:Apache License
public final EventRecord getEventRecord() { return JSON.parse(getRecordString()).cast(); }
From source file:com.google.speedtracer.client.messages.HintMessage.java
License:Apache License
public static HintMessage create(String hintMessageStr) { return JSON.parse(hintMessageStr).cast(); }
From source file:com.google.speedtracer.client.messages.PageEventMessage.java
License:Apache License
public final RawDebuggerEventRecord getDebuggerRecord() { return JSON.parse(getRecordString()).cast(); }
From source file:com.google.speedtracer.client.SymbolServerController.java
License:Apache License
private void init() { Xhr.get(symbolManifestUrl.getUrl(), new XhrCallback() { public void onFail(XMLHttpRequest xhr) { // Let pending requests know that the manifest failed to load. for (PendingRequest request : pendingRequests) { request.callback.onSymbolsFetchFailed(ERROR_MANIFEST_NOT_LOADED); }/*from w w w . j a v a2 s .com*/ cancelPendingRequests(); SymbolServerService.unregisterSymbolServerController(mainResourceUrl); if (ClientConfig.isDebugMode()) { Logging.getLogger().logText("Fetching manifest " + symbolManifestUrl.getUrl() + " failed."); } } public void onSuccess(XMLHttpRequest xhr) { // TODO (jaimeyap): This needs to be validated... and we should handle // any parsing errors as well. try { SymbolServerController.this.symbolServerManifest = JSON.parse(xhr.getResponseText()).cast(); } catch (JSONParseException jpe) { if (ClientConfig.isDebugMode()) { Logging.getLogger().logText("Unable to parse manifest for " + symbolManifestUrl.getUrl()); } onFail(xhr); // Treat an invalid manifest like a network failure. return; } SymbolServerController.this.manifestLoaded = true; // Now service all the pending requests. while (!pendingRequests.isEmpty()) { serviceRequest(pendingRequests.remove(0)); } if (ClientConfig.isDebugMode()) { Logging.getLogger().logText("Manifest " + symbolManifestUrl.getUrl() + " loaded."); } } }); }
From source file:com.google.speedtracer.hintletengine.client.HintletEngine.java
License:Apache License
public void onMessage(MessageEvent event) { if (eventRecordProcessor == null) { eventRecordProcessor = new HintletEventRecordProcessor(getAllRules()); }/*from w ww .ja v a 2 s .com*/ JavaScriptObject record = JSON.parse(event.getDataAsString()); eventRecordProcessor.onEventRecord(record); }