Reading http file on url
- by Nkunzis
I am trying to read an xml file on an http url. "Unexpected end of file from server" keeps on coming . the page is password protected, I would like to know if I am properly giving in my url authentication details.
I tried with non protected pages and I can read them properly. Here is my code:
URL url = new URL("http://username:[email protected]:0000/test.xml");
URLConnection yc = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();