I am streaming an image through tomcat 6.29.  In a browser the image
looks fine. But in an email in Outlook 2003 and 2010 the image does not
display.  Any thoughts?  

 

System.out.println content:

 

fileSize:80848

contentTypeStr:image/jpeg

 

The file name does have .jpg

 

Code:

 

if (contentTypeStr != null)

                  {

                        resp.setContentType(contentTypeStr);

                        try

                        {

                        File file = new File(filePath);

                        long fileSize = file.length();

                        int fileSizeInt = (int)fileSize;

                        resp.setContentLength(fileSizeInt);

                        System.out.println("fileSize:" + fileSizeInt);

                        System.out.println("contentTypeStr:" +
contentTypeStr);

                        }

                        catch(Exception e)

                        {

                        }

                  }

                  //

                  InputStream is =
FileAssistant.getInputStream(filePath);

                  if (is == null)

                  {

                        resp.sendError(404);

                        return;

                  }

                  //

                  OutputStream out = resp.getOutputStream();

                  try

                  {

                        int data = 0;

                        while ((data = is.read()) > -1)

                        {

                              out.write(data);

                        }

                        out.flush();

                        out.close();                  

                  }

                  catch (Exception e)

                  {

                  }

 

Thanks,

 

Lance Campbell

Software Architect/DBA/Project Manager

Web Services at Public Affairs

217-333-0382

 

Reply via email to