Here is the code:
m_origImage = getImage("http://av.warehousesports.com/sw/thumbs/BHCLBP-thumb.jpg");
It works
m_origImage = getImage("http://www27.brinkster.com/pksenthilsub/a40.aspx");
but not for this URL
private Image getImage(
String Url) throws IOException
{
HttpConnection conn = null;
InputStream in = null;
ByteArrayOutputStream bout = null;
Image img = null;
try
{
conn = (HttpConnection)Connector.open(Url);
conn.setRequestProperty("Connection", "close");
in = conn.openInputStream();
bout = new ByteArrayOutputStream();
int b;
while ((b = in.read()) != -1)
{
bout.write(b);
}
img = Image.createImage(bout.toByteArray(), 0, bout.size());
//form.append(new ImageItem("", img, ImageItem.LAYOUT_CENTER, ""));
}
finally
{
if (conn != null)
{
conn.close();
conn = null;
}
if (in != null)
{
in.close();
in = null;
}
if (bout != null)
{
bout.close();
bout = null;
}
}
return img;
}
-------------------------------------------
I have also tried using connection and status check and all such combinations but no luck
ContentConnection connection = (ContentConnection)Connector.open(url);
conn = (HttpConnection)Connector.open(url);
int status = conn.getResponseCode();
if( status != 200 )
...
...
Well in what way it depends on the server? Atleast i should get the stream out of the request if not the proper image right ? I am not getting even getting the stream output.
Thx
Senthil