On Mar 6, 2007, at 7:41 PM, Mark Lundquist wrote:

Hi,

On Mar 6, 2007, at 3:44 PM, wc184 wrote:

The problem I have is the URL has to match "dlchs*-_-*.xml". This,
subsequently, prompts the user to save the file under this format by
default. I would IE to prompt the user to save under the original filename.

I think you need these response headers:

        Cache-Control: Pragma:no-cache
        Content-Disposition: attachment; filename=what.ever

You can use the HTTPHeaderAction within your pipeline to set those from the sitemap.



I posted a similar question recently:
        http://www.mail-archive.com/[email protected]/msg37572.html

Other messages in an earlier thread seemed to indicate that
setting the header with an action for a file served by a cocoon reader
did not work:
         http://www.mail-archive.com/[email protected]/msg35877.html
         http://www.mail-archive.com/[email protected]/msg35879.html

And another message somewhere seemed to say there was a similar problem
with doing it from flowscript.

I noted in another message the correction that it did in fact work for
me using flowscript to set the headers before calling the pipeline
using the reader:
        http://www.mail-archive.com/[email protected]/msg37586.html


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();
}


And, in fact, I just tried Mark's simpler solution with an HttpHeaderAction, and that simpler solution also works ( despite those messages in the mail-list archive suggesting
that both do not work! )


      <map:match pattern="*/*.xml">
        <map:act type="set-header">
<map:parameter name="Cache-Control" value="Pragma:no- cache" /> <map:parameter name="Content-Disposition" value="attachment ; filename={2}.xml" />
        </map:act>
        <map:read src="published/{1}/{2}.xml" mime-type="text/xml" />
      </map:match>



I guess the lesson here is that reports that something does work are probably more reliable than reports that something doesn't work: there can be all sorts of other reasons something
doesn't work than the reason inferred by the original posters.



-- Steve Majewski / UVA Alderman Library





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

Reply via email to