curl response is different from the responce of java.net.URL -


curl -v https://whatwg.org/html

header is:

http/1.1 301 moved permanently
location: https://html.spec.whatwg.org/multipage

however..

string link = "https://whatwg.org/html"; url url = new url(link); httpurlconnection conn = (httpurlconnection) url.openconnection(); int status = conn.getresponsecode(); system.out.println("response code ... " + status); 

response code ... 200

the first , second results different, doing wrong , how should receive 301 ?


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -