0

我已经实现了 Java Spring Rest 客户端应用程序,每个休息都在获取输入 xml 文件,并根据文件值对​​该文件进行征税,然后选择 Javafx Webview 中显示的 jsp 文件,一旦你的事务完成,我需要关闭那个 webview 窗口。将结果作为 rest clinet 响应发回。对于每个请求,我需要打开 javafx webview winodow 并处理它。

但这里面临onec问题。

休息客户呼叫

static String url ="http://localhost:8080/login.jsp?value=47&key=645";
    javafx.application.Application.launch(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接口对象

public class BrowserApp {



    public void exit() {
        System.out.println("exist calling button");
        Browser.frame.setVisible(false);
    }
}

问题是一个请求成功完成,下一个请求得到“主错误:java.lang.IllegalStateException:应用程序启动不能被多次调用”。如何处理。任何其他方式来处理这个问题,谢谢

4

0 回答 0