I am trying to send REST request by sending CURL command with Java Process Runtime with the code:
Process p = Runtime.getRuntime().exec("curl -i --user user_name:password -H \"Content-Type: application/json\" -X PUT url_without_quote -d @/home/user_name/put_content.json");
However, I received 415 Unsupported Media Type even with header specified. I've tried the above command in terminal and it works fine with 200 return code. I've also tried GET request with the same options in curl command without -d content of PUT request, and it returns 200, and GET correct response content.
It's weird in the sense that the same command works in terminal but fails in java process running code.
Have you encountered the same issue or have any solution?
I doubt if there are some additional header need to be specified for PUT REST request or the character cases of "Content-Type: application/json" matters?