Skip to content

Commit

Permalink
CCDM: small refactor to fix odd JS error
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Aug 12, 2019
1 parent 1c99f08 commit c688a41
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,17 @@ public void send(JsonObject payload) {
responseHandler.setRequestStartTime(Profiler.getRelativeTimeMillis());

String payloadJson = WidgetUtil.stringify(payload);
XMLHttpRequest xhr = Xhr.post(getUri(), payloadJson,

String uri = registry.getApplicationConfiguration().getServiceUrl();
uri = SharedUtil.addGetParameter(uri,
ApplicationConstants.REQUEST_TYPE_PARAMETER,
ApplicationConstants.REQUEST_TYPE_UIDL);

uri = SharedUtil.addGetParameter(uri,
ApplicationConstants.UI_ID_PARAMETER,
registry.getApplicationConfiguration().getUIId());

XMLHttpRequest xhr = Xhr.post(uri, payloadJson,
JsonConstants.JSON_CONTENT_TYPE, responseHandler);

Console.log("Sending xhr message to server: " + payloadJson);
Expand All @@ -178,25 +188,6 @@ public void run() {
}
}

/**
* Retrieves the URI to use when sending RPCs to the server
*
* @return The URI to use for server messages.
*/
protected String getUri() {
String uri = registry.getApplicationConfiguration().getServiceUrl();
uri = SharedUtil.addGetParameter(uri,
ApplicationConstants.REQUEST_TYPE_PARAMETER,
ApplicationConstants.REQUEST_TYPE_UIDL);

uri = SharedUtil.addGetParameter(uri,
ApplicationConstants.UI_ID_PARAMETER,
registry.getApplicationConfiguration().getUIId());

return uri;

}

private static native boolean resendRequest(XMLHttpRequest xhr)
/*-{
if (xhr.readyState != 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ private native void hookUpPolymerElement(StateNode node, Element element)
var props = Object.getOwnPropertyNames(changedProps);
var items = "items.";
var i;
for(i=0; i<props.length; i++){
// There should be a property which starts with "items."
// and the next token is the index of changed item
Expand Down

0 comments on commit c688a41

Please sign in to comment.