I want to analyze data from a password protected RSS feed. If I try to parse the data, it throws a "File not found Exception"
Here is my code:
try {
DBF = DocumentBuilderFactory.newInstance();
DB = DBF.newDocumentBuilder();
url_val = new URL("http://admin:admin@dev.quaddeals.com/university-of-illinois/androids/city.rss");
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
dom = DB.parse(url_val.openConnection().getInputStream());
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
elt = dom.getDocumentElement();
NodeList items = elt.getElementsByTagName("item");
for (int i = 0; i < items.getLength(); i++) {
Node item = items.item(i);
NodeList properties = item.getChildNodes();
for (int j = 0; j < properties.getLength(); j++) {
Node property = properties.item(j);
String name = property.getNodeName();
if (name.equalsIgnoreCase("title")) {
cityTitle = property.getFirstChild().getNodeValue();
}
if (name.equalsIgnoreCase("id")) {
cityId = property.getFirstChild().getNodeValue();
}
}
title.add(cityTitle);
id.add(cityId);
}
VALUE1 = new String[title.size()];
Iterator<String> itc = title.iterator();
while (itc.hasNext()) {
l1++;
VALUE1[l1] = itc.next().toString();
}
VALUE2 = new String[id.size()];
Iterator<String> it1c = id.iterator();
while (it1c.hasNext()) {
m1++;
VALUE2[m1] = it1c.next().toString();
}
} catch (Exception e) {
}
My Cat log shows the error as follows:
02-21 23:20:48.893: WARN/System.err(19206): java.io.FileNotFoundException: http:
02-21 23:20:48.893: WARN/System.err(19206): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1064)
02-21 23:20:48.893: WARN/System.err(19206): at com.fsp.quaddeals.DealCities$SelectDataTask_Deals.doInBackground(DealCities.java:341)
02-21 23:20:48.893: WARN/System.err(19206): at com.fsp.quaddeals.DealCities$SelectDataTask_Deals.doInBackground(DealCities.java:1)
If I enter this URL in the browser, it will ask for authentication, after which it will be redirected to the original RSS FEED, where my parsing data exists.
I want to analyze the data on this page. How can I access this password protected page and analyze the data? Does Android support SSL connections?
Venky source
share