This is already performed automatically by ResourceStreamRequestTarget but IE disregards the header after opening the download-dialog:
// and content disposition if any String file = getFileName(); if (file != null && (response instanceof WebResponse)) { ((WebResponse)response).setAttachmentHeader(file); } My code: public void onClick() { IResourceStream resourceStream = new AbstractResourceStream() { private ByteArrayInputStream byteStream; public synchronized void close() throws IOException { if (byteStream != null) { byteStream.close(); byteStream = null; } } public synchronized InputStream getInputStream() throws ResourceStreamNotFoundException { FileAttachment fileAttachmentWithBytes = DatabaseServices .getById(fileAttachment); return byteStream = new ByteArrayInputStream( fileAttachmentWithBytes.getBytes()); } }; getRequestCycle().setRequestTarget( new ResourceStreamRequestTarget(resourceStream, fileAttachment.getName())); } ** Martin 2008/5/30 Rodolfo Hansen <[EMAIL PROTECTED]>: > there is a DynamicWebResource (String filename) constructor you can use to > specify the filename you want for the resource... > > On Thu, May 29, 2008 at 4:27 PM, Martin Makundi < > [EMAIL PROTECTED]> wrote: > >> It is an IE "bug" or "feature" that it disregards the content type >> after opening up the download (file save/open) dialog -> It uses >> windows file extension detection after that ;) On Firefox the content >> type suffices, but for IE I must hack the filename too. >> >> ** >> Martin >> >> 2008/5/29 Rodolfo Hansen <[EMAIL PROTECTED]>: >> > I think maybe what you want is to use a DynamicWebResource >> > and customize the ResourceState to return the correct content type... >> > >> > It makes more sense that a .doc link be of that type I think... >> > >> > On Thu, May 29, 2008 at 10:18 AM, Martijn Lindhout < >> [EMAIL PROTECTED]> >> > wrote: >> > >> >> setting the HTTP Content-Disposition may help. The value should be >> >> something >> >> like >> >> >> >> attachment; filename=DummyFilename.doc >> >> >> >> 2008/5/26 Martin Makundi <[EMAIL PROTECTED]>: >> >> >> >> > Hi! >> >> > >> >> > I have a web page whose content the user is supposed to save as a >> >> > XYZ.doc file. With Firefox it is sufficient to set the content-type to >> >> > application/msword. >> >> > >> >> > However, Internet Explorer takes my context path (the part before the >> >> > url parameters) as the filename, say "webapp" and forgets about the >> >> > content type already. Is there a simple way to mount my dnyamic page >> >> > as "DummyFilename.doc"? >> >> > >> >> > I would rather not use BookmarkablePage because the parameters are >> >> > huge. Ofcourse I could pass the parameters via an internal model, but >> >> > if there is a fast moujnting strategy for a dynamic page, I would be >> >> > interested. >> >> > >> >> > ** >> >> > Martin >> >> > >> >> > --------------------------------------------------------------------- >> >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> > For additional commands, e-mail: [EMAIL PROTECTED] >> >> > >> >> > >> >> >> >> >> >> -- >> >> Martijn Lindhout >> >> JointEffort IT Services >> >> http://www.jointeffort.nl >> >> [EMAIL PROTECTED] >> >> +31 (0)6 18 47 25 29 >> >> >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]