. Net and Httpwebrequest are equivalent in Java?
•
Java
. Net has Httpwebrequest and webclient to simulate browser requests
I will Google, but I don't know what keywords to use
I want to write HTTP get and post, cookies and cookies in applets or local jars, and give responses in the form of text strings or other parseable structures
Solution
Httpurlconnection is the Java equivalent of Httpwebrequest
URL iurl = new URL(url); HttpURLConnection uc = (HttpURLConnection)iurl.openConnection(); uc.connect(); if (uc.getContentType().equalsIgnoreCase("image/jpeg")) { result = true; }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码