Bonsoir,

je voudrais d'envoyer une image de servlet vers midlet mais malheureusement je ne sais pas comment faire ça.
j'ai suivi ce Tutorial :
http://jahbromo.blogspot.com/2009/10...e-servlet.html
mais je sais pas c'est le problème est dans mon servlet. voici le code de ma servlet:
public class gettext extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see Servlet#init(ServletConfig)
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{


// reads input file from an absolute path
String filePath = "D:/aglets/aglets-2.0.2/image/hotel.png";
File downloadFile = new File(filePath);
FileInputStream inStream = new FileInputStream(downloadFile);
// if you want to use a relative path to context root:
String relativePath = getServletContext().getRealPath("");
System.out.println("relativePath = " + relativePath);
// obtains ServletContext
ServletContext context = getServletContext();
// gets MIME type of the file
String mimeType = context.getMimeType(filePath);
if (mimeType == null) {
// set to binary type if MIME mapping not found
mimeType = "application/octet-stream";
}
System.out.println("MIME type: " + mimeType);
// modifies response
response.setContentType(mimeType);
response.setContentLength((int) downloadFile.length());

// forces download
String headerKey = "Content-Disposition";
String headerValue = String.format("attachment; filename=\"%s\"", downloadFile.getName());
response.setHeader(headerKey, headerValue);

// obtains response's output stream
OutputStream outStream = response.getOutputStream();

byte[] buffer = new byte[1024];
int bytesRead = -1;

while ((bytesRead = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, bytesRead);
}

inStream.close();
outStream.close();


}
}
SVP aidez moi et merci d'avance.
Cordialement.