我目前在 PHP 中有这个,并且想知道 Java 中的等价物是什么。
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $vals[$index["CM:URL"][0]]["attributes"]["VALUE"]);
header("Content-type: " . $vals[$index["CM:RESOURCEOBJECT"][0]]["attributes"]["MIMETYPE"]);
$content = curl_exec($ch);
curl_close($ch);
谢谢!
最佳答案
参见Apache HttpClient对于 curl 部分。
与 HttpServletResponse.addHeader ,您可以发送您的 Content-type
header 。
关于java - 如何在 Java 中执行等效的 cURL/mimetype 代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3240705/