开发者

How can I do the equivalent cURL/mimetype code in Java?

开发者 https://www.devze.com 2023-01-07 05:12 出处:网络
I have this currently in PHP and was wondering what the equivalent would be in Java. $ch = curl_init();

I have this currently in PHP and was wondering what the equivalent would be in 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);

Thanks!


See Apache HttpClient for the curl part.

With HttpServletResponse.addHeader, you can send your Content-type header.

0

精彩评论

暂无评论...
验证码 换一张
取 消