Java get response code from URL -


while (it.isvalid()) {         simpleattributeset s = (simpleattributeset) it.getattributes();         linkurls = (string) s.getattribute(html.attribute.href);          if (linkurls != null) {              system.out.println(linkurls);          }         it.next();      } 

this loop shows urls.

how display getresponsecode () each address? must done in loop? can write such code? not know how go it.

you're going need open urls, warned relative or protocol-relative (unless library you). once rebuild url, do

url url = new url(urlstr);  // might idea validate connection type before casting httpurlconnection connection = (httpurlconnection)url.openconnection(); connection.getresponsecode(); 

Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -