0
apiからデータを読み込むことができませんhtmlデザインは現在のものです。webview javafxでapiからデータにアクセスできません
私はdata.inフロントエンドangular2のためのバックエンドでの使用は、休止状態、春のMongoDBのです。私はjavafx webviewからアクセスURLですが、それはデータを表示しません。
JavaFXのコード:
final WebView browser = new WebView();
final WebEngine webEngine = browser.getEngine();
webEngine.load("http://192.168.2.6:4200/");
webEngine.setJavaScriptEnabled(true);
browser.getEngine().getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
System.out.println(browser.getEngine().getLoadWorker().exceptionProperty());
}
});
TrustManager trm = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
};
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, new TrustManager[] { trm }, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
休止状態、春のAPI:
@CrossOrigin
@SuppressWarnings("unchecked")
@RequestMapping(value = "/getById", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public <T> T getById(@RequestParam(ERPUtils.ID_PARAM_FOR_API) String id,
@RequestParam(ERPUtils.ENTITY_NAME_PARAM_FOR_API) String entityName) {
T t = null;
/* It returns rough object of passed id. */
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_ROUGH)) {
Rough rough = erpService.getById(id, new Rough());
t = (T) rough;
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_LOT)) {
t = (T) erpService.getById(id, new Lot());
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_CUT)) {
Cut cut = erpService.getById(id, new Cut());
t = (T) cut;
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_PIECE)) {
Piece piece = erpService.getById(id, new Piece());
t = (T) piece;
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_TAG)) {
Tag tag = erpService.getById(id, new Tag());
t = (T) tag;
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_PLAN)) {
Plan plan = erpService.getById(id, new Plan());
t = (T) plan;
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_SUBPLAN)) {
SubPlan subPlan = erpService.getById(id, new SubPlan());
t = (T) subPlan;
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_USER)) {
User user = erpService.getById(id, new User());
user.setPassword(null);
user.setEncryptedToken(null);
t = (T) user;
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_WEIGHT_UNIT)) {
WeightUnit weightUnit = erpService.getById(id, new WeightUnit());
t = (T) weightUnit;
}
if (entityName.equalsIgnoreCase(ERPUtils.TABLE_NAME_FOR_PRICE_UNIT)) {
PriceUnit priceUnit = erpService.getById(id, new PriceUnit());
t = (T) priceUnit;
}
return (T) (t == null ? ERPUtils.NO_RECORD_FOUND : t);
}