当前位置: 动力学知识库 > 问答 > 编程问答 >

Getting response of curl request in jsp

问题描述:

There is a curl request working properly in terminal. You can copy paste following curl request in terminal as a command.

curl -H "Content-Type: application/json" -d '{

"code":"4be18766d47d4d60bfe9", "client_id": "e56693ca9d2c248f275d",

"client_secret":

"e2fc71d1d58679cc27b4f46ae6b4f2399519e9fdc8c99253531e186bd17b"}'

https://www.wunderlist.com/oauth/access_token

you can see the output.

I want to run same curl request in jsp. I wrote following code for it but its not generating output.

Process p=Runtime.getRuntime().exec("...");

p.waitFor();

BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));

String line=reader.readLine();

while(line!=null) {

out.println(line);

line=reader.readLine();

}

In curl request I use original values of my test case, so that you can get idea that what exactly I am asking. After getting answer I will change it.

分享给朋友:
您可能感兴趣的文章:
随机阅读: