简体   繁体   English

如何拨打 javascript function 从 java 拨打 axios api

[英]How to call javascript function making a axios api call from java

I have a javascript function which make a.network call using the axios library.我有一个 javascript function,它使用 axios 库进行网络调用。 The function supports for GET and POST. function 支持 GET 和 POST。 My requirement is to call the same javascript function from Java, which internally will make a.network call using axios.我的要求是从 Java 调用相同的 javascript function,这将在内部使用 axios 进行网络调用。

You can create a node.js application that uses the axios library to accomplish what you need and call it from Java with code similar to this:您可以创建一个 node.js 应用程序,它使用 axios 库来完成您需要的工作,并使用类似于以下的代码从 Java 调用它:

Runtime run  = Runtime.getRuntime();
run.exec(command);

That said, Java has excellent libraries for.networking to probably fit your requirement.也就是说,Java 具有出色的 .networking 库,可能可以满足您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM