在我的XPages应用程序中,我必须调用curl命令
代码很简单:
public static InputStream executeCurlCommand(String finalCurlCommand) throws IOException
{
return Runtime.getRuntime().exec(finalCurlCommand).getInputStream();
}
但是,似乎命令根本没有执行。
当我执行以下命令时(在Linux终端中):
curl -k -i -X GET https://someHost/fws/api/esia/login?redirectUrl=https://redirectHost/sed/gecho/2019/gecho_apps_2019.nsf/Nav2.xsp
我得到输出。
但是每当我用Java执行它时,都不会起作用。 getInputStream()
为空。
同时,如果我在本地Windows计算机上执行此代码,一切都很好。从cmd执行的命令也是如此。
但是在XPages中,没有例外,没有错误,只有一无所有。
是否有调试方法?
UPD
如果我将命令更改为像ls -la
一样简单的命令,一切正常:x
public static InputStream executeCurlCommand(String finalCurlCommand) throws IOException
{
return Runtime.getRuntime().exec(finalCurlCommand).getInputStream();
}
在UNIX系统中。使用ProcessBuilder代替