|
From: Bavo De R. <ba...@co...> - 2005-06-03 20:15:59
|
Hi, I have added support for this to PFC. Whenever you have a getResourceURL method, there is a corresponding getDownloadURL method. You can use that to generate "<a href=..." html. The getDownloadURL takes an extra parameter: the filename. This is the proposed filename the browser can use in the Save As ... dialog. All the online resources are updated on http://pfc.coderspotting.org/: You can find the new release at http://pfc.coderspotting.org/dev/dsp_release.html The new javadoc is at http://pfc.sourceforge.net/javadoc/ and is also included in the release file. Classes of interest that have changed are: portal.core.render.HtmlGraphics portal.core.render.IVelocityPageContext For an example of generating inline download urls for resources managed by the ResourceService, you might also check out the velocity template at: src/resources/portal/demo/controls/ControlsDemoPanel.vm If there is anything not working as expected or just unclear, do not hesitate to ask! Greets, Bavo On Friday 27 May 2005 09:41, Joost Vandenbosch wrote: > Hi All, > > I'm using the pfc framework and for the application I'm building I need to > make a link at the client side that forces a save as for a resource (file > from database), so that instead of being displayed in the browser when > clicking on it, the browser should ask to save it on the hard drive. > > For this I have created a separate servlet which writes the http header as > follows : > > response.setHeader(Content-Type,text/html); > response.setHeader(Content-Disposition, attachment; filename=+ > (String)hash.get(file_name)); > > I would like to avoid having an additional servlet besides the framework > and would like to implement in the framework using the interface IResource. > Is there a way to change the header from this class so that I don't need to > create an additional servlet or is there another way to force the save as > in a browser ? > > Thanks in advance, > > Regards, > Joost. -- Bavo De Ridder Visit the SourceForge projet page: http://www.sourceforge.net/projects/pfc |