On Mar 2, 2007, at 11:31 AM, Ard Schrijvers wrote:
I do not think I totally understand your story, but, you just need
to set some header (content-disposition) on a reader, right?
Why don't you extend the reader (for example, you use the
ResourceReader) and only add to your reader:
protected void setupHeaders() {
super.setupHeaders();
response.setHeader("content-disposition","what-ever-it-might-be");
}
Hope this helps,
Ard
Is there a way to add java classes 'locally' -- that is, somewhere
in the directory tree containing my sitemap ? ( There's an
organizational
split between responsibility for the server (tomcat + cocoon) and
responsibility for the applications. So organizationally, a flowscript
solution is easier for me to test and deploy than a java solution --
if that requires dropping a jar into cocoon/WEB-INF/lib. )
But luckily, some of the messages in that earlier thread seem to have
been in error.
They may have been correct about it not working from an Action, but
this flowscript function DOES work for me (at least tested in Camino
on Mac.),
whether or not the uri request maps to a pipeline implemented by a
reader
or some other sort of pipeline:
function download() {
var uri = cocoon.request.getParameter( 'uri' );
var filename = uri.substr( uri.lastIndexOf( '/' ) + 1 );
cocoon.response.addHeader( 'Content-disposition', 'attachment ;
filename=' + filename );
cocoon.sendPage( uri, {} );
cocoon.exit();
}
-- Steve Majewski
I found an old thread describing the same problem I'm running into --
but it seems to end here. Has anyone else found a solution ?
I have xml files served up by a cocoon reader.
They sometimes generate annoying errors messages in the browser.
Normally, these are styled into html in cocoon, but a raw
directory link is provided for download -- but all of the
users don't know they should right-click, and they get confused
by the error messages into thinking that it didn't completely
load. I would rather not go thru the xml pipeline, if only to
allow them to download broken XML files to edit and fix.
But it doesn't look like you can set the content-disposition
header from an action or from flowscript when using a reader.
Any ideas ?
-- Steve Majewski / UVA Alderman Library
On Sep 29, 2006, at 11:24 AM, Geert Josten wrote:
PS:
I believe I also tried setting the header from FlowScript,
but had the
impression it was either ignored or overruled by the reader..
Kind regards,
Geert
-----Oorspronkelijk bericht-----
Van: Geert Josten [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 29 september 2006 17:04
Aan: [email protected]
Onderwerp: RE: RE: link to a file
Hi,
You found the thread on which I based my solution! :-)
However, for some reason it doesn't work on readers. I hadn't
noticed until after my first reply that I had commented it
out in my own sitemap and had replaced it with a
generate/serialize wrapped in the set-header action.
It looks apparently like the response object is not yet
created at the moment that the action is executed, which is
before the reader. Design flaw?
Kind regards,
Geert
Drs. G.P.H. Josten
Consultant
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is
afkomstig van Daidalos BV en is uitsluitend bestemd voor de
geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen,
verzoeken wij u het te verwijderen. Aan dit bericht kunnen
geen rechten worden ontleend.
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens
Bertrand Delacretaz
Verzonden: vrijdag 29 september 2006 16:49
Aan: [email protected]
Onderwerp: Re: RE: link to a file
On 9/29/06, Roel Croonenberghs
<[EMAIL PROTECTED]> wrote:
...it opens .html, .txt, .jpg, .gif files in the browser
instead of
downloading them...
You need to set the content-disposition HTTP header to trigger a
download, this thread shows how (I think, didn't check in detail):
http://marc2.theaimsgroup.com/?l=xml-cocoon-users&m=1108910965
22009&w=2
And this explains the principle:
http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.html
-Bertrand
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]