i have implemented Java Spring Rest client application, each rest am geting input xml file , and taxking that file according file values am select jsp file showing in Javafx Webview, once ur transaction completed i need to close that webview window. send back result as rest clinet response. for every request i need to open javafx webview winodow and process it.
but here am faceing onec issues.
Rest cleint Call
static String url ="http://localhost:8080/login.jsp?value=47&key=645";
javafx.application.Application.launch(Webview.class);
Webview class
public class Webview extends Application {
public static Stage stage;
public static WebView view;
@Override
public void start(Stage _stage) throws Exception {
System.out.println("Start");
stage = _stage;
Platform.setImplicitExit(true);
StackPane root = new StackPane();
view = new WebView();
WebEngine engine = view.getEngine();
engine.load(PaymentServerRestAPI.BROWSER_URL);
root.getChildren().add(view);
engine.setJavaScriptEnabled(true);
Scene scene = new Scene(root, 800, 600);
stage.setScene(scene);
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent arg0) {
Platform.exit();
}
});
JSObject window = (JSObject) engine.executeScript("window");
window.setMember("app", new BrowserApp());
stage.show();
}
}
//JavaScript interface object
public class BrowserApp {
public void exit() {
System.out.println("exist calling button");
Browser.frame.setVisible(false);
}
}
problem is one request successful completed next request am getting "ERROR IN MAIN:java.lang.IllegalStateException: Application launch must not be called more than once". how to handle this. any other way to handle this problem ,thanks