javascript - Checking exists JS function in JavaFX WebEngine -
i need execute script file myfunctions.js in javafx webengine , send info server resttemplate:
public void ondevicestatuschanged(devicestatusevent devicestatusevent) { string uri = defaultpage + "my/" + "devices/status"; if (devicestatusevent.getdevstat().getdev() == 0) { webengine.executescript("billacceptorstatus(" + devicestatusevent.getdevstat().getstatus() + ")"); } if (devicestatusevent.getdevstat().getdev() == 1) { webengine.executescript("posprinterstatus(" + devicestatusevent.getdevstat().getstatus() + ")"); } if (devicestatusevent.getdevstat().getdev() == 2) { webengine.executescript("cardreaderstatus(" + devicestatusevent.getdevstat().getstatus() + ")"); } if (devicestatusevent.getdevstat().getdev() == 4) { webengine.executescript("pinpadstatus(" + devicestatusevent.getdevstat().getstatus() + ")"); } try { if (devicestatusevent.getdevstat().getdev() == 0) { if (devicestatusevent.getdevstat().getstatus() == 2) { httpentity request = new httpentity<>(defaultheaders.getmap()); string string = resttemplate.postforobject(defaultpage + "/my/" + "devices/ink", request, string.class); } } httpentity<simpledevstat> request = new httpentity<>(devicestatusevent.getdevstat(), defaultheaders.getmap()); resttemplate.postforlocation(uri, request); log.debug("posted : " + devicestatusevent.getdevstat()); webengine.executescript("networkstatus(true)"); } catch (exception e) { webengine.executescript("networkstatus(false)"); e.printstacktrace(); } }
if myfunctions.js not loaded webengine, webengine.executescript() not worked , code stop line. need check exists myfunctions.js in webengine. how check js file in webengine?
Comments
Post a Comment