BlackBerry HttpConnection Content of URL
I make HttpConnection by the following way:
try {
StreamConnection s = (StreamConnection)Connector.open(url);
HttpConnection httpCon开发者_开发技巧n = (HttpConnection)s;
} catch (Exception e) {
Dialog.alert(e.getMessage());
}
How can I get the content of the url (the text inside the url html file)
Thanks,
Thry something like this:
StreamConnection c = null;
InputStream s = null;
byte[] response;
try {
c = (StreamConnection)Connector.open(url);
s = c.openInputStream();
response = IOUtilities.streamToBytes(s);
} finally {
if (s != null)
s.close();
if (c != null)
c.close();
}
String html = new String(response);
You can get this by the following link.........
http://supportforums.blackberry.com/t5/Java-Development/Want-to-get-Response-from-the-particular-URL/m-p/1291627#M172814
精彩评论