How can I do the equivalent cURL/mimetype code in Java?
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.
精彩评论