06-25-2010, 06:38 AM
|
#1 (permalink)
|
| Knows Where the Search Button Is
Join Date: Jun 2010 Model: 7100 PIN: N/A Carrier: Dev
Posts: 19
Post Thanks: 0 Thanked 0 Times in 0 Posts
| HTTP Connection Please Login to Remove! Hello,
HttpConnection connection = null;
connection =(HttpConnection) Connector.open(url, Connector.READ_WRITE, true);
connection.setRequestMethod(HttpConnection.GET);
// connection.setRequestProperty("Content-Type","application/vnd.syncml+xml");
// connection.setRequestProperty("Content-Length",String.valueOf(0));
// connection.setRequestProperty("User-Agent","Profile/microedition.profiles Configuration/microedition.configuration");
// connection.setRequestProperty("Content-Language","microedition.locale");
));
try
{
InputStream iStream = connection.openInputStream();
}catch(Exception e)
{
e.printStackTrace();
System.out.println("Connection getResponseCode==="+connection.getResponseCode());
System.out.println("Connection Establish==="+e.getMessage());
}
System.out.println("Connection Establish===");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[10000];
int bytesRead = inputStream.read(buffer);
while (bytesRead > 0) {
baos.write(buffer, 0, bytesRead);
bytesRead = inputStream.read(buffer);
}
baos.close();
String result=baos.toString();
ByteArrayInputStream bais =
new ByteArrayInputStream(result.getBytes());
Http connection is not Establishing from this code
Am tring in Black Berry simulator
Is there Need any settings for HTTP Connection
Thanks in adv
Venkatesh |
| Offline
| |