hi
try content type: image/jpeg
i guess you app-server doesnt know how to handle 'img/jpeg'.
regards,
c)hristian

Hi,

I'd like to have a URL like this:

http://localhost:8080/myapp/ImageView/pict01.jpg

so I make a page class as below, but when I use the above URL, Firefox will
prompt user either to save or open the file instead of displaying directly
the image, what is the proper way to do this?
Thanks,

A.C.

public class ImageView {


    public StreamResponse onActivate(String jpegName) {
        String mapDir = System.getProperty("java.io.tmpdir");
        String fileName = mapDir + "/" + jpegName;

        InputStream imageFileInputStream = null;
        try {
            imageFileInputStream = new FileInputStream(fileName);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
return createStreamResponse(imageFileInputStream); }

    private StreamResponse createStreamResponse(final InputStream is) {
        return new StreamResponse() {
            public String getContentType() {
                return "img/jpeg";
            }
            public InputStream getStream() throws IOException {
                return is;
            }
            public void prepareResponse(Response response) {
            }
        };
    }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to