java.net.URL to refer to a CSS -
how create java.net.url refer css? posible?
i've tried several other ways check if css page doesn't work (no errors tho, doesn't):
        int code = con.getresponsecode();         string type = con.getcontenttype();          con.disconnect();          //returns null if connection had problems or not contain css         if (code != httpurlconnection.http_ok || !type.contains("stylesheet")) {             return null;         }   any other posible solutions? try css page , print it.
take code below example
url url = new url("http://cdn.sstatic.net/stackoverflow/all.css?v=e97b23688ee8"); // css on site httpurlconnection con = (httpurlconnection) url.openconnection();  scanner scanner = new scanner(con.getinputstream()); while(scanner.hasnextline())      system.out.println(scanner.nextline());  system.out.println(con.getcontenttype()); // prints text/css   you looking wrong content-type.
Comments
Post a Comment