Hi to all,

I'm doing a new class that contains a two method to show pictures. I'm using Apache, the web server program, and my application has to connect with Apache(by localhost), to download the pictures I have placed in folder "htdocs" of Apache. But the program doesn't work. Apparently, but I'm not sure, there is not connection between the program and the webpage.
I send you here the code, and maybe someone can help me.

Thank you very much,

Luisarca

Program:

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import java.io.*;
import java.util.Vector;




class mostrarfotos extends Canvas
{

private int width;
private int height;
private Image img;
private HttpConnection c;
Display display=null;
Form form=null;
mostrarfotos(String nombrefoto)
{
width = getWidth();
height = getHeight();
// Load the graphics
String url = "http://localhost/" + nombrefoto;
System.err.println(url);
DataInputStream is = null;
StringBuffer sb = new StringBuffer();
img=null;

try
{
c =(HttpConnection) Connector.open(url);
c.setRequestProperty("Content-Language","es-ES");
c.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.0");
c.setRequestProperty("Connection","close");
c.setRequestMethod(HttpConnection.GET);
int len = (int)c.getLength();
System.err.println("aqui ya no llego /n");
if (len > 0)
{
is = c.openDataInputStream();
byte[] data = new byte[len];
is.readFully(data);
img = Image.createImage(data, 0, len);
}
else
{
showAlert("length is null");;
}
is.close();
c.close();
}
catch (Exception e)
{
System.err.println("Problem loading image ");
e.printStackTrace();
showAlert(e.getMessage());
}
}

/* Display Error On screen*/
private void showAlert(String err)
{
Alert a = new Alert("");
a.setString(err);
a.setTimeout(Alert.FOREVER);
display.setCurrent(a);
}



public void paint(Graphics g)
{

//Paint a white background
g.setColor( 0, 0, 0 );
g.fillRect( 0, 0, getWidth(), getHeight() );
g.setColor( 255, 255, 255);
// Paint the sprite
g.drawImage(img,0,0,Graphics.TOP|Graphics.LEFT);
}


}